-
Notifications
You must be signed in to change notification settings - Fork 71
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
Improve CRS Caching, add CoordinateReferenceSystem.equals overload #33
Improve CRS Caching, add CoordinateReferenceSystem.equals overload #33
Conversation
Signed-off-by: Grigory Pomadchin <gr.pomadchin@gmail.com>
Signed-off-by: Grigory Pomadchin <gr.pomadchin@gmail.com>
Since you aren't using a bounding, the speedup compared to In Java 8 the The hesitation for a full prescreen, like Caffeine, is because at 32+ cores the performance diverges to be a benefit. Doug theorized it is because of GC safepoints and biased locking, which are general problems the JVM is addressing. Since the cache strives to have hot entries (else a poor hit rate) on server-class machines, we can make a much simpler choice rather than think through everyone's map scenarios on various machine sizes. So if you didn't want the dependency you could simply mimic it as, var value = map.get(key);
if (value != null) {
return value;
}
return map.computeIfAbsent(key, mappingFunction); |
@ben-manes thanks for the insights, I didn't realize that. I think this will work out good for our needs. Tbh I don't think, that there is a need in a separate Caching library, since there would be not a lot of data, and even in the worst case it would not be bad. |
If interested, here is Doug's reply on this optimization. The remaining discussion in that thread was wrt a different issue, recursive computations, which was also improved in JDK9. |
@ben-manes I double checked the behavior on bounded and unbounded
I would say that I'll rollback this commit. Also at this point we can't use JDK 9/10/11 everywhere. However thanks a lot for this extra helpful information. |
oh interesting! yeah, rollback. I really don't know why Caffeine is better but I'm never unhappy when that's true :) |
@ben-manes woooot I looked into the old terminal window; look at these results, you were right and I'm super happy that it aligns with the information you wrote:
So definitely c9b25e9 would be the thing. Thanks again! 👍 |
haha, no problem. Not too often I pipe in to recommend not using my library 😉 |
@ben-manes maestro 💯 :D |
Signed-off-by: Grigory Pomadchin <gr.pomadchin@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
This PR addresses locationtech/geotrellis#3022 and locationtech/geotrellis#2890
Notes
Benchmarking results: