https://bz.apache.org/bugzilla/show_bug.cgi?id=69398
Bug ID: 69398
Summary: Excess object allocation in PageContextImpl
Product: Tomcat 9
Version: 9.0.x
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: Jasper
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: -----
The constructor org.apache.jasper.runtime.PageContextImpl includes this line:
this.outs = new BodyContentImpl[0];
Heap analysis of our large, JSP-heavy app shows large numbers of
BodyContentImpl[], with sizes ranked in order of frequency:
[0]
[1]
[2]
[3]
[4]
There are two ways to address this:
1. Define "private static final EMPTY_ARRAY = new BodyContentImpl[0]" and
assign this value in the constructor
2. Change the allocation to BodyContentImpl[1] or [2], thus eliminating [0] and
copies
My testing shows that change #1 eliminates the [0] arrays and saves < 5% of
clock time; this is definitely about heap pollution rather than direct runtime.
Option #2 is harder to predict since it potentially adds overhead when the [0]
is sufficient.
--
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]