2026-09-12 12:03:42
Introducing PrimeHash → KC3 symbols hash table perfect hashing
Write a hash function with the help of ChatGPT for error checking and insightful tests.
Put all your symbols under it in a hash table with a nice bitmask. Count the collisions.
Make an interface where you can report hash table usage and collisions.
Find a seed where all your symbols fit under a few megs of memory without any collision.
The seed for all the 2600+ symbols in the git.kmx.io website is a wonderful 10.
???
Profit.
Related source code files on git.kmx.io :
- https://git.kmx.io/kc3-lang/kc3/_tree/master/libkc3/primehash.h
- https://git.kmx.io/kc3-lang/kc3/_tree/master/libkc3/primehash.c
- https://git.kmx.io/kc3-lang/kc3/_tree/master/libkc3/sym_ht.c