Repository navigation
Hold the standalone identifier marker in the EvaluationContext - #1081
Merged
Merged
Conversation
AstIdentifier sets ELResolver.StandaloneIdentifierMarker for every identifier it resolves (TRUE for a stand-alone identifier, then back to FALSE). Holding it in the EvaluationContext, which is what the resolvers are passed, rather than in the map of the wrapped ELContext saves the map updates of every identifier. With Mojarra's test/perf pages, this lowers the CPU time per request by about 2%. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
AstIdentifiersetsELResolver.StandaloneIdentifierMarkerin the context for the resolution of every identifier:TRUEbefore the resolution of a stand-alone identifier, and back toFALSEafter the resolution of every identifier.EvaluationContextpassesputContexton to the wrappedELContext, so each identifier costs one or two updates of the wrapped context'sHashMap. Frameworks evaluate many identifiers per request, so these updates add up.This change holds the marker in a field of the
EvaluationContextinstead. The resolvers are passed theEvaluationContext, so they still see it,ImportELResolveramong them. Two side effects:ELContextafter an evaluation (asFALSE).EvaluationContext. It no longer sees the marker of the evaluation that triggered it.A new test in
TestAstIdentifierchecks that a resolver sees the marker for${marked}but not for${marked.length()}, and that theELContextdoes not hold the marker afterwards. The EL tests (**/el/**/Test*.java, includingTestImportELResolver) pass.Measurement
test/perfpages (42 pages) on Tomcat 11.0.25, with Tomcat's EL built from source in each arm, measured A B C C B A on one GitHub Actions runner. C is a replicate of B and serves as the noise reference.AstIdentifierchanged to put the marker the waymaindoes (TRUEonly for a stand-alone identifier,FALSEafterwards). I measured this rather thanmainitself because Mojarra 4.1 targets Jakarta EE 11.No changelog entry is included; I can add one if you prefer.
This work was done with Claude Code (Claude Opus 5.5); the commit carries a
Co-Authored-Bytrailer.🤖 Generated with Claude Code