Generate C code quickly and easily with two command line tools.
One practical application of this software is in implementing Unicode support, where a lot of lookup tables are required for sparse, non-contiguous integer sets. With this software's mkhashtable, one can easily create a hash table to obtain a compact and quick static hash table with minimal hassle.
mkhashtable is especially useful for integer hashing, as it generates an integer lookup table with a similar idea to gperf. The primary difference is that the input keys are not strings, but integers. This makes it an ideal tool for people who have a set of integers they wish to look up or map to other values, i.e., individuals who require an integer dictionary.
This tool is especially helpful if the integer set isn't contiguous. Essentially, mkhashtable is a C++ application that pre-computes a two-bucket cuckoo hash table using a set of integers. The outcome is a highly compressed table that typically has a utilization of 80%, can be connected statically to your program, and offers extremely fast lookup times, with the worst case being O(1) with maximally two hash operations.
In addition, the hash table computation process is quick, as the tool allows you to tweak the generation algorithm for large sets and trade generation speed for table utilization as needed. Cuckoo hash tables are effective on modern processors with caches since they eliminate the heap-wide distributed linked lists typically used by chaining hashing methods. All keys and values are stored in one contiguous block of memory, making for a faster lookup.
Future versions of the mkhashtable tool will allow people to generate different types of cuckoo hash tables with varying numbers of buckets and hash functions to compress the tables even further, albeit with a tradeoff of lookup speed.
The second tool offered by Lookup Tables C Code Generator is called mkstringswitch, which is meant for string dictionaries. This tool is similar to gperf since it takes a specification and generates C code, but the technique for lookup is different. Instead of finding a hash function, mkstringswitch uses switch() + memcmp/strcmp to recursively search for the strings.
This tool is ideal for people looking to use large sets where gperf takes too long to compute a solution or for small sets where they may have forgotten how to use gperf and just want code quickly. Overall, Lookup Tables C Code Generator is an ideal software tool for people looking to generate highly compressed, quick lookup hash tables in C.
Version 1.89198: N/A