I've been working on my small chess engine, and I have hash table for threefold detection.
I want to implement Zobrist hashing, but I made a string hash key just for a placeholder. But it seems really slow, it takes like a full 1ms doing 1-depth search. Perft function without threefold detection is much faster than this..
Is hashing with string keys really slower?
Yes, the time to hash a string will depend on its length, while a fixed size number will take constant time. Even if the actual data amount is the same, there will likely be more overhead in processing a string.
This is the first time I have heard about "Zobrist", but it seem to be based around "bitstrings" that are XOR:ed together. Using actual strings to represent such a bitstring, instead of a ulong, will be far slower since there is no simple way to XOR strings together.
But performance is complicated, getting close to the actual theoretical performance of the hardware usually require intimate knowledge of both the hardware, compilers and other tools. I would recommend using a profiler, since that should tell you what is actually taking time