palPool / C++ String Pool (that never empties)
I developed a C++ string pooling class as a single-header utility.
This was part of an effort to create a JVM … for $reasons
…
I developed a C++ string pooling class as a single-header utility. This was part of an effort to create a fast JVM-like system.
One key feature involves managing a large number of strings from serialized bytecode, which are used as constants or indicators. Given the finite number of these strings and their persistence throughout the address space, I implemented a string pool using a hash map (MurmurHash) to store and retrieve strings. Each unique string is stored once, and subsequent operations can compare their pointers, improving performance. This builds on Jason Gregory’s use of MurmurHashes in Naughty Dog’s engines, where finite-sized IDs were used for string comparisons in animation logic. (He discusses this in his book)
I updated the header recently, and the source is available on Codeberg:
https://codeberg.org/paintgoblin/stb_like/src/branch/main/pal_pool.hpp