Closed kleinreact closed 3 years ago
I didn't know about hashUsing
before. Thus, thanks for the hint. It definitely looks like the cleaner solution.
BTW, do you see any actual performance improvements as a result of this change?
The adhoc approach and hashUsing
perform quite similar, but both are a huge improvement against ignoring the salt. You can use the code snippet above for testing. The difference should be easily observable with that.
Thanks a lot for the observation and fix! I have pushed a new commit 7e954264dc8356d37e0400953e486d1d80da4498 that implements Simon's suggestion.
The salt shouldn't be ignored since the HashMap has poor performance when adding new elements (as used here) otherwise. Composed types like tuples are usually hashed via chaining the elements' hashes through the salt (cf. here).
I used the following code for testing: