Skip to content
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

Better handle hash collisions by using Java LinkedHashMap #193

Merged
merged 1 commit into from
Oct 18, 2018

Conversation

gmethvin
Copy link
Member

Switch the underlying map implementation to use a Java LinkedHashMap with the Scala wrapper, to take advantage of the Java implementation's more efficient handling of hash collisions where the keys are Comparable.

Fixes #186.

@gmethvin
Copy link
Member Author

Parsing an object with 10000 hash collisions (-i 10 -wi 5 -f1 -t4):

before:

[info] # Warmup Iteration   1: 6.028 ops/s
[info] # Warmup Iteration   2: 7.308 ops/s
[info] # Warmup Iteration   3: 7.593 ops/s
[info] # Warmup Iteration   4: 7.768 ops/s
[info] # Warmup Iteration   5: 7.949 ops/s
[info] Iteration   1: 6.925 ops/s
[info] Iteration   2: 7.489 ops/s
[info] Iteration   3: 7.810 ops/s
[info] Iteration   4: 7.867 ops/s
[info] Iteration   5: 7.485 ops/s
[info] Iteration   6: 7.732 ops/s
[info] Iteration   7: 7.634 ops/s
[info] Iteration   8: 7.656 ops/s
[info] Iteration   9: 7.571 ops/s
[info] Iteration  10: 7.343 ops/s

after:

[info] # Warmup Iteration   1: 297.834 ops/s
[info] # Warmup Iteration   2: 538.602 ops/s
[info] # Warmup Iteration   3: 660.174 ops/s
[info] # Warmup Iteration   4: 698.398 ops/s
[info] # Warmup Iteration   5: 783.469 ops/s
[info] Iteration   1: 761.133 ops/s
[info] Iteration   2: 788.541 ops/s
[info] Iteration   3: 789.512 ops/s
[info] Iteration   4: 775.890 ops/s
[info] Iteration   5: 778.181 ops/s
[info] Iteration   6: 767.591 ops/s
[info] Iteration   7: 726.882 ops/s
[info] Iteration   8: 764.094 ops/s
[info] Iteration   9: 764.370 ops/s
[info] Iteration  10: 769.734 ops/s

Copy link
Member

@marcospereira marcospereira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @gmethvin.

@marcospereira marcospereira merged commit ef1197b into master Oct 18, 2018
@mkurz mkurz deleted the hash-collisions branch October 18, 2018 19:15
@gmethvin
Copy link
Member Author

gmethvin commented Oct 18, 2018

Does someone want to backport and make a new 2.6 release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants