AngeloRubens opened a new pull request, #1081:
URL: https://github.com/apache/tomcat/pull/1081

   `AstIdentifier` sets `ELResolver.StandaloneIdentifierMarker` in the context 
for the resolution of every identifier: `TRUE` before the resolution of a 
stand-alone identifier, and back to `FALSE` after the resolution of every 
identifier. `EvaluationContext` passes `putContext` on to the wrapped 
`ELContext`, so each identifier costs one or two updates of the wrapped 
context's `HashMap`. Frameworks evaluate many identifiers per request, so these 
updates add up.
   
   This change holds the marker in a field of the `EvaluationContext` instead. 
The resolvers are passed the `EvaluationContext`, so they still see it, 
`ImportELResolver` among them. Two side effects:
   
   - The marker is no longer left in the application's `ELContext` after an 
evaluation (as `FALSE`).
   - A nested evaluation started while an identifier is being resolved has its 
own `EvaluationContext`. It no longer sees the marker of the evaluation that 
triggered it.
   
   A new test in `TestAstIdentifier` checks that a resolver sees the marker for 
`${marked}` but not for `${marked.length()}`, and that the `ELContext` does not 
hold the marker afterwards. The EL tests (`**/el/**/Test*.java`, including 
`TestImportELResolver`) pass.
   
   ### Measurement
   
   - Setup: Mojarra's `test/perf` pages (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.
   - Baseline: the 11.0.25 EL with `AstIdentifier` changed to put the marker 
the way `main` does (`TRUE` only for a stand-alone identifier, `FALSE` 
afterwards). I measured this rather than `main` itself because Mojarra 4.1 
targets Jakarta EE 11.
   - Result: total CPU time per request changed by −2.6%, −1.7% and −1.6% in 
three runs (B vs C noise 0.3%, 0.6% and 1.5%), so about **−2%** on average. The 
responses were identical in all arms.
   - Against plain 11.0.25 (which puts the marker twice for every identifier), 
the same change measured −0.8% and −2.1%.
   
   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-By` trailer.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to