faragon/libsrt
View on GitHub ↗ ★ 558 C
libsrt is a C library for writing fast and safe C code, faster. It provides string, vector, bit set, set, map, hash set, and hash map handling. Suitable for soft and hard real-time. Allows both heap and stack allocation. *BETA* (API still can change: suggestions are welcome)
28 mentions on Hacker News by 1 person: 1 story, 27 comments · first 2015-04-21 · latest 2019-12-05
20082026
-
For C string library with stack allocation and some Unicode support you can check: https://github.com/faragon/libsrt
comment by faragon · 2019-12-05 · in Simple Dynamic Strings library for C, compatible with null-terminated strings -
…but if someone wants to check a different implementation looking for ideas (BSD licensed, too): https://github.com/faragon/libsrt
comment by faragon · 2019-12-03 · in Simple Dynamic Strings library for C, compatible with null-terminated strings -
…a LUT accelerator for reaching the Nth level, but hardly could be implemented using a vector. [1] https://github.com/faragon/libsrt/blob/master/src/saux/stree... [2] I'm implementing a key-value hash table that will be added to the same…
comment by faragon · 2018-11-10 · in Beating hash tables with trees? The ART-ful radix trie -
…ipedia.org/wiki/Rabin%E2%80%93Karp_algorithm Implementation example (2 GB/s scan on modern 3GHz CPU): https://github.com/faragon/libsrt/blob/master/src/saux/ssear...
comment by faragon · 2018-10-17 · in Ask HN: What's your favorite elegant/beautiful algorithm? -
…size data compression (e.g. PB's using a 64-bit compiler, if you have enough memory): git clone https://github.com/faragon/libsrt make ./enc -ezh <hugefile >output.zh For decompress: ./enc -dz <output.zh >hugefile.again
comment by faragon · 2018-10-03 · in Zstandard Compression and the application/zstd Media Type -
…infinite-size dictionary (LZ77, using a hash table for O(1) pattern search), you can try: git clone https://github.com/faragon/libsrt cd libsrt make ./enc -ezh <hugefile >hugefile.z ./enc -dz <hugefile.z >hugefile.again For 1MB dictionary…
comment by faragon · 2018-02-17 · in When to use Dictionary Compression -
More examples (C89/90 preprocessor compatible): Function building using templates: https://github.com/faragon/libsrt/blob/master/src/saux/ssort.c Passing macros to macros (meta-templates): https://github.com/faragon/libsrt/blob/master/src/s…
comment by faragon · 2018-01-26 · in Some obscure C features -
…aliasing (i.e. allowing in-place encoding/decoding, check senc_b64() and sdec_b64() functions): https://github.com/faragon/libsrt/blob/master/src/saux/senc....
comment by faragon · 2018-01-18 · in Fast base64 encoding and decoding -
…data in most implementations. You can use radix sort in C, too, e.g. some benchmarks [1] [1] https://github.com/faragon/libsrt/blob/master/doc/benchmarks...
comment by faragon · 2017-07-16 · in Death to C, ++ -
…to std::map <std::string, std::string>: > 1M QPS (> 2M QPS if key size <= 19 bytes) [1] Repository: https://github.com/faragon/libsrt [2] Benchmarks: https://github.com/faragon/libsrt/blob/master/doc/benchmarks...
comment by faragon · 2017-07-03 · in Writing a Memory Allocator for Fast Serialization -
…the risk. E.g. you can avoid using malloc() directly, using abstractions, even in C, e.g. [1]. [1] https://github.com/faragon/libsrt
comment by faragon · 2017-05-18 · in Further hardening glibc malloc() against single byte overflows -
…memory, with minimum memory fragmentation and suitable for soft/hard real-time requirements. [1] https://github.com/faragon/libsrt
comment by faragon · 2017-05-06 · in The Horror in the Standard Library -
…string and dynamic memory handling (with data types in both heap and stack), consider checking https://github.com/faragon/libsrt (not production ready for "NASA-like" things, but I've put an important effort in test-coverage, aliasing…
comment by faragon · 2017-04-11 · in Cello – A library that brings higher level programming to C -
…but not in C, as default qsort() relies on sorting functions-). With some benchmarks, too [3] [1] https://github.com/faragon/libsrt [2] https://faragon.github.io/svector.h.html [3] https://github.com/faragon/libsrt/blob/master/doc/benchmark…
comment by faragon · 2017-01-07 · in C99/C11 dynamic array that mimics C++'s std::vector -
E.g. compare C++ std::map vs std::unordered_map on strings. You can find some benchmarks here: https://github.com/faragon/libsrt/blob/master/doc/benchmarks... (for 16 and 64 byte strings: cxx_map_s16, cxx_umap_s16, cxx_map_s64,…
comment by faragon · 2016-12-28 · in Hash tables with open addressing -
…to avoid breaking past things with new changes. You can check that I try to honor what I say, here: https://github.com/faragon/libsrt/blob/master/examples/stest... However, there are cases where unit testing is not suitable, or it is not a…
comment by faragon · 2016-12-08 · in Kent Beck: “I get paid for code that works, not for tests” (2013) -
…* log(n) additional space is required ([1]). [1] Here is an example, look for st_tr_aux() function: https://github.com/faragon/libsrt/blob/master/src/stree.c
comment by faragon · 2016-10-09 · in Space Requirements for Tree Traversal -
…allocation. E.g. allocating a vector in the stack would require no explicit de-allocation (example: https://github.com/faragon/libsrt ). For heap allocation, you would need to call some sometype_free(&a) function, obviously (there is no…
comment by faragon · 2016-09-25 · in Talking to C Programmers about C++ [video] -
…in tables, you can opt for encoding ranges in the code, e.g. check sc_tolower()/sc_toupper() into: https://github.com/faragon/libsrt/blob/master/src/schar.c
comment by faragon · 2015-08-09 · in Utf8rewind changes for 1.2.1 -
…for the problem we're speaking (just strings and other data structures, not a "NodeJS for C"): https://github.com/faragon/libsrt > I concur C++ should be able to, but I again request large scale examples, because I've never seen any. Have…
comment by faragon · 2015-08-06 · in “The Dream of Internet Freedom Is Dying” -
…for using just one allocation, instead of 2 -one for the instance, and another for the buffer-): https://github.com/faragon/libsrt/blob/master/src/sdata.c
comment by faragon · 2015-08-04 · in C++ Internals: STL Vector, Part I -
…per container, using also geometric growing, and supporting both stack and heap allocation: https://github.com/faragon/libsrt/blob/master/src/svector.h
comment by faragon · 2015-08-04 · in C++ Internals: STL Vector, Part I -
…== 0, 0); return a > SIZE_MAX / b ? val_if_saturated : a * b; } P.S. examples taken from: https://github.com/faragon/libsrt/blob/master/src/senc.c (underflow example) https://github.com/faragon/libsrt/blob/master/src/scommon.h (overflow…
comment by faragon · 2015-08-01 · in Should I Use Signed or Unsigned Ints? -
…things that were not still covered (I'll investigate the Kore string/buffer implementation, too): https://github.com/faragon/libsrt/blob/master/doc/references...
comment by faragon · 2015-05-19 · in Kore: a fast web server for writing web apps in C -
…for high-level C code, with hard real-time in mind, is already functional for static linking: https://github.com/faragon/libsrt
comment by faragon · 2015-05-17 · in Kore: a fast web server for writing web apps in C -
Easy strings for C, with Unicode support (and as fast as std::string): https://github.com/faragon/libsrt
comment by faragon · 2015-05-17 · in Kore: a fast web server for writing web apps in C -
▲ 8
Show HN: libsrt – fast C library with heap and stack allocationstory by faragon · 2015-04-21 · 5 comments