Also there is the header-only khash.h [3], complete with benchmarks:
https://attractivechaos.wordpress.com/2008/08/28/comparison-...
(Also provides kbtree.h, ksort.h, kstream.h, kvec.h)
[3] https://attractivechaos.wordpress.com/programs/
Also there are the stb header-only libraries. There is a hash table implementation buried inside stb.h
Re:Write a hash table in C
by DSMan195276 on Wednesday August 23, 2017 @07:00PM
(#15085951)
Definitely look into the Linux kernel data structures. Container_of is a fantastic way to do data structures in C.
Also, BSD tree.h for red-black trees and splay trees http://bxr.su/OpenBSD/sys/sys/tree.h
I think at this point if you aren't in a very constrained platform, it doesn't really make sense to use someone else's data structure implementations unless they at least support some kind of CPU parallelism. Preferably openmp or whatever suits the algorithm at hand.
Re:Write a hash table in C
by deadgrey19 on Thursday August 24, 2017 @12:58AM
(#15087692)
A bit of ongoing work from me. Trying to make wiring C programs fast and painless.
- BSD queue.h offers linked lists, queues, etc [1].
- UT-hash offers hash tables [2].
I've also read some people being frustrated with them, probably due to the quirky syntax/API. On the plus side (BSD at least) it's just a header file that you can download, include and start using.
[1] http://bxr.su/OpenBSD/sys/sys/queue.h
[2] https://troydhanson.github.io/uthash/