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

Avoids using lambdas in MacroEvaluator hot paths. #1045

Open
wants to merge 1 commit into
base: ion-11-encoding-optimize-initial-expression-array-size-session-pools-merge-presencebitmap-pool
Choose a base branch
from

Conversation

tgregg
Copy link
Contributor

@tgregg tgregg commented Jan 31, 2025

Description of changes:

These three lambdas were all in the top 9 contributors to total allocations when reading test data. After this change, they're gone. Note: the new allocation profile results show that the JVM optimizes away the no-op lambda.

Also note: beginning with this PR I've moved to version of the test dataset that does not use make_string invocations, as they are an optional feature that users may choose to use when data size is more important than read performance. As a result, these numbers are not directly comparable to the numbers in preceding PRs.

Speed: 219 ms/op -> 219 ms/op (0%)
Allocation rate: 124 KB/op -> 113 KB/op (-8.9%)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

@jobarr-amzn jobarr-amzn left a comment

Choose a reason for hiding this comment

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

This doesn't seem like a good place to be in. A 9% drop in allocation is definitely not nothing, but the 0% change in speed makes me wonder how much allocation we have to improve before we're faster.

Can you add comments in these sites explaining why you're not using an initialization lambda, or a comment on _Private_RecyclingStack#push explaining that capturing lambdas ought to be avoided?

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