https://bz.apache.org/bugzilla/show_bug.cgi?id=68068
Bug ID: 68068
Summary: Hotspot in Ast*Nodes: itable method calls
Product: Tomcat 9
Version: 9.0.x
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: EL
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: -----
In-depth profiling of a high-volume, performance-sensitive application
identified an avoidable use of an itable method call, a.k.a. invoking an
interface method rather than a static or virtual method. The performance
impact is well described at
https://stackoverflow.com/questions/21679998/does-it-matter-for-runtime-performance-if-a-method-is-called-by-its-explicit-typ#:~:text=invokeinterface%20is%20known%20to%20be,to%20prefer%20invokevirtual%20to%20invokeinterface%20
The underlying problem is calls to Node.getValue(), such as in
AstAnd.getValue():
Object obj = children[0].getValue(ctx);
where "children" is "Node[]". There are roughly 30 distinct implementations of
Node and no JIT is capable of optimizing those away.
Fortunately, all 30 of the Node implementation extends the class SimpleNode.
Changing the references to Node to use SimpleNode will enable JVMs to instead
use invokevirtual.
Our tools struggle to measure the actual impact of this issue, because it
occurs in small amounts in so many different code paths, and occurs repeatedly
in each layer of a nested AST evaluation. My best guess is 0.2% cpu, directly
on the latency critical path.
I hope the fix is as simple as it seems. :)
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]