Remove potentially problematic memory optimization in BlockSubLevelLiftProvider - #1419
Draft
KosmX wants to merge 1 commit into
Draft
Remove potentially problematic memory optimization in BlockSubLevelLiftProvider#1419KosmX wants to merge 1 commit into
KosmX wants to merge 1 commit into
Conversation
Avoid using "globals to avoid allocation", this way JIT can do proper escape analysis, do proper optimizations (and make the function thread-safe too)
Owner
|
have you done benchmarking to support this for this case, or is it simply speculative? |
Owner
|
I haven't had great experiences with this sortof thing but I'm happy to be proven wrong. I typically see the vector allocation showing up heavily in profiling for CPU time, it's what sparked this pattern in the first place |
Author
|
It is speculative, I don't know when can I do benchmarking. or with what profiler. What is your profiler setup? maybe I can use that. |
Author
|
Tomorrow I'll attempt to profile this with async-profiler, but I have no idea if this change is measurable. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Avoid using "globals to avoid allocation", this way JIT can do proper escape analysis, do proper optimizations (and make the function thread-safe too)
More details on escape analysis:
https://docs.oracle.com/javase/8/docs/technotes/guides/vm/performance-enhancements-7.html#escapeAnalysis
There are many reasons why I would not create globals to avoid allocation:
I was thinking on what might be worse with this, but I couldn't find many reasons. Some allocations will occur before JIT compiles the function, but that probably doesn't matter (since compilation will happen pretty fast)
Also because this patch removes a few fields, it might break some mods, so merging this might be a bit risky.
And since the function isn't a performance bottleneck anyway, I would say this PR is pretty low priority.