Add hashmaps/microbenchmarks/insertHeavy benchmark #338
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a benchmark for
Data.HashMap.Mutable.Linear
which inserts a bunch of keys in random order. Here're some details of the benchmark:Int
's for which thehash
value is salted with a large number.Here's the result of the benchmark on GHC HEAD (
378c0bba7d
):One thing I found when I'm implementing this is that, when you remove the salt from the
hash
function (and therefore making itidentity
for ourInt
keys) we are a lot faster. The fact that it gets faster makes sense, since there are no hash collisions (the largestInt
is smaller than our capacity in this benchmark). But the fact that it gets almost twice as fast is curious, since I don't expect that much collisions. I had a look at our probe sequence lengths and found that most of the keys indeed did not have collisions; which means that even a few collisions slows downs our implementation disproportionately.Also, this has two minor improvements to the existing benchmark suite (see the individual commits). Another note about the implementation is that it looks a bit different than the existing HashMap benchmarks. It has two reasons: