pjfanning opened a new pull request, #1330:
URL: https://github.com/apache/poi/pull/1330

   `WorkbookEvaluator.evaluateFormula` keeps its operand stack in a 
`java.util.Stack`, which extends `Vector`: every `push`/`pop`/`peek` is a 
`synchronized` method, and every token of every formula goes through it.
   
   `ArrayDeque` is the JDK's recommended replacement and a drop-in here: only 
`push`, `pop`, `peek` and `isEmpty` are used, all with the same LIFO semantics, 
and nothing null is ever pushed (the operation result is null-checked before 
the push; the other pushes are popped values, constants and error evals). The 
one observable difference — `pop()` on an empty deque throws 
`NoSuchElementException` instead of `EmptyStackException` — cannot occur: the 
parser produces balanced token streams and an unbalanced one would be an 
internal error either way (`TestMissingArgEval` covers the historical case 
where it did, bug 43354, which was fixed by handling `MissingArgPtg`, not by 
catching the exception).
   
   Uncontended monitor enter/exit is cheap on a modern JVM, so this is a small 
per-token saving rather than a headline one; too small to resolve against the 
±10% noise of the benchmark machine, hence no numbers. Formula test suites 
green.
   
   🤖 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