in reply to fast hash search
Create an index with the thing you are looking up as the hash key. In this case, loop over all the entries once, building another hash such that $index{string}=key2. Then reference that index as many times as needed, quickly.
If the reverse mapping is not unique, than things are more difficult, but you get the idea.
|
|---|