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

Koloboke Obj Maps slowed down with Java 8 VMs #42

Open
leventov opened this issue Aug 13, 2015 · 3 comments
Open

Koloboke Obj Maps slowed down with Java 8 VMs #42

leventov opened this issue Aug 13, 2015 · 3 comments

Comments

@leventov
Copy link
Owner

See http://stackoverflow.com/a/31994785/648955

@dmk23
Copy link

dmk23 commented Sep 17, 2015

Is there any update on this issue?

I am also wondering if there is supposed to be a performance advantage of using JDK8 vs JDK6-7 flavor of the library on Java8 runtime. Are there any benchmarks comparing these two cases? Is there anything about JDK8 flavor that is supposed to make it faster / more compact?

@leventov
Copy link
Owner Author

@dmk23

I did some benchmarking after that SO discussion and found that it is not that bad for Koloboke actually.. sometimes it is still considerably faster than HashMap.

Also, as the result of thinking about these issues the https://github.com/OpenHFT/SmoothieMap project emerged. Koloboke tend to perform worse when keys are actually compared by equals(), not just identity ==. and SmoothieMap designed so that keys almost never compared, even much more rarely than in HashMap. So, if in your case HashMap is better than Koloboke, it worth to compare with SmoothieMap, too.

The outcome is: make the benchmark closest to your real case (or better just substitute hash map impls in your real case) and compare performance metrics. HashMap might appear to be the fastest on average, but in majority of cases I expect either Koloboke or SmoothieMap to outperform HashMap. They are three different algorithms with different performance consequences.

I am also wondering if there is supposed to be a performance advantage of using JDK8 vs JDK6-7 flavor of the library on Java8 runtime. Are there any benchmarks comparing these two cases? Is there anything about JDK8 flavor that is supposed to make it faster / more compact?

The idea was indeed to improve in Jdk8 but actually they don't differ yet. Just use the version according to you runtime Java version.

@leventov
Copy link
Owner Author

The striked statement above is incorrect. To be more specific, when key is queried, average number of times it is compared by equals() to another key and they are not equal:

  • for Koloboke: ~ 0.1-1 times
  • SmoothieMap - ~ 0.01 times
  • HashMap: ~ 0

So SmoothieMap compare keys more often than HashMap, but still very rarely

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

No branches or pull requests

2 participants