3 ms·
Agreed. Even in the author's use-case, just hashing the string itself would be much better.
by dingo_bat 8y ago
Agreed. Even in the author's use-case, just hashing the string itself would be much better.
- quotemstr 8y agoWhat? No. Hashing a string involves extra pointer chasing and looping over a variable-length data structure, and that's on top of the collision-chain resolution the hash table itself has to do. In performance-sensitive code (like a dynamic language interpreter), it's far better to intern your strings and look them up by ID (i.e., pointer value) directly.