Acknowledgements
January 3, 2019 · View on GitHub
- RB tree implementation based on Julienne Walker`s red-black tree insert and delete top down algorithms (beautiful)
- Rabin-Karp search algorithm
- 7-bit parallel case conversions learned from Paul Hsieh examples
References (recommended lectures and code review)
Generic data structures
- libulz
- GDSL (reentrant): http://home.gna.org/gdsl/
- Gnulib: https://www.gnu.org/software/gnulib/
- Apache APR
- Includes iconv, snprintf, etc. Very interesting.
- https://apr.apache.org/download.cgi
- atomic: atomic increments
- dso: dynamic library
- encoding: ASCII <-> EBCDIC, escape/unscape URL, hex, escape/unscape "entity" (ML)
- file_io: copy dir, seek, r/w, open, mktemp, dup, stat
- locks: spinlock, mutex
- memory: memory pool (Win32-only)
- misc: utf8, charset, rand, error codes, env
- mmap: map file on memory
- network_io: sockets
- passwd:
- poll: fd poll (unix, os2)
- random: random + sha256/384/512
- shmem: shared memory IPC
- strings: strnatcmp, strtok, fnmatch, snprintf, strings, cpystrn (no full Unicode support)
- support: 3KB. waitio (Unix fd poll)
- tables: hash table, skip list, memory leak detection helpers
- test: unit tests
- threadproc: thread, process, and signal utilities
- time: time utils
- tools: test generator helper
- user: userinfo, groupinfo:
- GLib
- https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html
- Inspected: g_strnfill, g_str_has_prefix, g_str_to_ascii, g_str_is_ascii, g_ascii_islower, ...
- SGLIB
- http://sglib.sourceforge.net/
- Simple Generic Library for C
- Faster than glib
- BSD-like
- Attractive Chaos klib
- clibutils
- liblfds
- BSD
- sparsehash
- Cliff Click`s hash table
- uSTL
- libwayne (Wayne`s Little Data Structures and Algorithms Library)
- klib
- qlib
- libxc (Extended C Library)
- http://sourceforge.net/projects/libxc/
- It has threaded support (POSIX-only). Doxygen doc.
- xvector: 20+4KB. Growable array (shrinking not supported), del/insert use memmove (i.e. slow)
- xtree: 9+1KB. Not sorted trees, but trivial generic tree.
- xstring: 34+1KB. Without Unicode support. Slow search. Very limited functionality.
- xsparse: 13+1KB. Naive map-like array. Uses xdict.
- xsock: 19+1KB. TCP sockets wrapper.
- xshare: 8+2KB. Dynamic library handling wrapper.
- xsarray: 12+1KB. Sorted array. Bult over xvector.
- xproc: Empty. Shows plans for thread wrapper implementation.
- xmalloc: 10+2KB. Wrapper for malloc.
- xfile: 15+1KB. Some file utilities. A bit strange.
- xerror: 5+4KB. Error reporting (log-like).
- xdict: 19+1KB. Map implementation ("associative arrays"). Naive implementation.
- xcrypto: 43KB. Random numbers and SHA256 hashes.
- xcfg: 24+1KB. Configuration file handling (read/write of key-value elements).
- libshl (not reviewed yet)
- libscl (not reviewed yet)
- Compact libc implementations
- musl: https://www.musl-libc.org/
- uClibc: https://uclibc.org/
- diet libc: https://www.fefe.de/dietlibc/
- The Art of Computer Programming (Donald Knuth): not used for this, but it is always a nice mention.
Strings
- SDS (Salvatore Sanfilippo, antirez)
- README.md structure.
- Equivalent sdsfromlonglong(), sdstrim() functionality.
- strbuf (Git project)
- Equivalent strbuf_grow(), strbuf_split_*() functionality.
- Documentation structure (https://github.com/git/git/blob/master/Documentation/technical/api-strbuf.txt)
- string library comparison
Unicode / character handling
- Unicode case/folding: http://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt
- Unicode table: http://unicode-table.com/en/
Sorting
- Generic
- Timsort
- https://en.wikipedia.org/wiki/Timsort
- http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6804124
Hash tables
- uthash
- Malte Skarupte blog posts
- https://probablydance.com/2017/02/26/i-wrote-the-fastest-hashtable/
- https://probablydance.com/2018/05/28/a-new-fast-hash-table-in-response-to-googles-new-fast-hash-table/
- https://probablydance.com/2018/06/16/fibonacci-hashing-the-optimization-that-the-world-forgot-or-a-better-alternative-to-integer-modulo/
- https://github.com/skarupke/flat_hash_map
- Misc
- https://research.cs.vt.edu/AVresearch/hashing/
- https://aras-p.info/blog/2016/08/02/Hash-Functions-all-the-way-down/
- https://rcoh.me/posts/hash-map-analysis/
- http://www.idryman.org/blog/2017/05/03/writing-a-damn-fast-hash-table-with-tiny-memory-footprints/
- http://www.ilikebigbits.com/2016_08_28_hash_table.html
- Benchmarks
Trees
- StackOverflow stuff
- Julienne Walker web site
- Wikipedia
- Misc
Memory allocation
- http://stackoverflow.com/questions/282926/time-complexity-of-memory-allocation
- http://www.gii.upv.es/tlsf/
- http://www.design-reuse.com/articles/25090/dynamic-memory-allocation-fragmentation-c.htm
Node cache size impact
- Effect of Node Size on the Performance of CacheConscious B+trees (Richard A. Hankins, Jignesh M. Patel)
String Matching
- Simple Real-Time Constant-Space String Matching (Dany Breslauer, Roberto Grossi, Filippo Mignosi)
- Text Searching Algorithms vol II: Backward String Matching (Borivoj Melichar)
Predictability
- Building Timing Predictable Embedded Systems (Philip Axer, Rolf Ernst, Heiko Falk, ...) [2012]
- Static Timing Analysis for Hard Real-Time Systems (Reinhard Wilhelm, Sebastian Altmeyer, ...)
- Timing-Predictable Memory Allocation In Hard Real-Time Systems (Jörg Herter) [2014]
Data compression
- Real-time LZ77 data compression
C language
- C preprocessor
- var args comp.lang.c FAQ http://www.lysator.liu.se/c/c-faq/c-7.html
- Count arguments: http://stackoverflow.com/questions/2124339/c-preprocessor-va-args-number-of-arguments
- C99 standard
- ISO/IEC 9899:TC3 Draft 20070907 http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf