Dropping some CompletableFuture allocations#3233
Merged
bbakerman merged 3 commits intographql-java:masterfrom May 30, 2023
Merged
Dropping some CompletableFuture allocations#3233bbakerman merged 3 commits intographql-java:masterfrom
bbakerman merged 3 commits intographql-java:masterfrom
Conversation
- dropping TracingInstrumentation as it is causing a lot of extra allocations - removing some warnings by IntelliJ - other minor cleanups
Avoiding some unneeded allocations of CompletableFuture in the internal Async util class.
This is really a minor optimization to avoid java.lang.Integer allocations.
bbakerman
approved these changes
May 30, 2023
| @SuppressWarnings("unchecked") | ||
| private static <T> CompletableFuture<T> typedEmpty() { | ||
| return (CompletableFuture<T>) EMPTY; | ||
| } |
Member
There was a problem hiding this comment.
This is a pretty good pattern for CFs that are really a static value - eg one that is completed and the same value
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.
Hello @bbakerman @andimarek
just trying to improve the allocation rate (see the discussion in #3175).
There are 3 commits:
indexparameter from Async CF factory functions: this will drop the allocations ofjava.lang.Integer.On my machine, I get the following numbers.
Baseline:
With this PR:
I see also that the allocation rate of
CompletableFutureis dropping a bit.Please have a look :)