I think you will probably lose perf. 1\. Strings are on the heap with value semantics, meaning you would need to allocate slow memory in the for loop for each strings
2\. For looping is O[n] 3\. Hashes are done via xor and shift which are faster than additions and substractions or allocating strings. 4\. Having a string as index means an extra indirection/dereferencing and no memory locality so more cache misses and no prefetching.