I'm looking for a performant but also memory efficient C hash map implementation (or whatever you want to call it). Performance is slightly more important than memory use.

I would prefer a implementation which is MIT licensed or was put into the public domain.

1 Answer 1



A few C hash table/map libraries exist but, based on your requirements, the only one that I know you could try is khash, by Attractive Chaos. It's part of klib, a standalone and lightweight C library.

Essentially khash is a fast and light-weighted hash table library in C (implemented as a C macro, which can also help the performance).

It's released under the MIT licence as clearly reported in the header file containing the actual implementation.

  • Although the author’s focus does not seem to be speed ("I would rather trade speed a bit for smaller memory.") it looks promising. I will give it a try.
    – idmean
    Jul 31, 2015 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.