-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate ChampHashMap performance regression: more calls to equals when looking up an missing element with a partially colliding hash code #525
Comments
@msteindorfer Is this a fundamental trade-off made by the CHAMP design, or a bug in the current implementation? Your paper discusses this different reasons that lookup could be slower, but haven't found a discussion of how many calls to
|
I suppose we'd need to add a |
Hi @retronym, there a discussion in the paper how many calls to hash code and The higher amount of
There's also a reference implementation of MEMCHAMP available that shows how to add the I hope that's enough pointers to get you started. I'm currently at PLDI and try get back to you later if you have remaining questions. |
Here's my WIP to implement hash code caching. https://github.com/scala/scala/compare/c0b038c...retronym:topic/champ-hash-code-cache?expand=1 |
That patch is still buggy. Intermittently, e.g.:
|
This test uses poorly distributed hash codes of small numbers.
ChampHashMap
(likeimmutable.HashMap
before it) uses the folllowing hash code improvement:Contrast this with the version used in
mutable.HashMap
:Those calls to
equals
occur inmap1.contains(missingKeys(i))
.ChampHashMap
callskey.equals(existingKey)
even those the hash codes differ.map1.contains(new Tracer(10283))
, which callsTracer(10283).equals(Tracer(4634.0))
(Tracer(4634.0)
is an existing element in the map).Notice the similarities in the hash codes:
Leads to:
Comparison with
immutable.HashMap
The old implementation first checked that the hash code of the located tree node is identical to the hash code of the key:
The text was updated successfully, but these errors were encountered: