https://bz.apache.org/bugzilla/show_bug.cgi?id=69429
Bug ID: 69429 Summary: Memory optimization to AstMethodParameters.getParameters() Product: Tomcat 9 Version: 9.0.x Hardware: PC Status: NEW Severity: normal Priority: P2 Component: Jasper Assignee: dev@tomcat.apache.org Reporter: jeng...@amazon.com Target Milestone: ----- Created attachment 39925 --> https://bz.apache.org/bugzilla/attachment.cgi?id=39925&action=edit Patch TestELParserPerformance.testExpressions() reveals an optimization to AstMethodParameters.getParameters(), source code below: public Object[] getParameters(EvaluationContext ctx) { List<Object> params = new ArrayList<>(); for (int i = 0; i < this.jjtGetNumChildren(); i++) { params.add(this.jjtGetChild(i).getValue(ctx)); } return params.toArray(new Object[0]); } Reflective EL expressions with no parameters have this.jjtGetNumChildren == 0, which is only tested after a new ArrayList<> has been allocated. An additional Object[0] is allocated for return. An early check of this.jjtGetNumChildren will eliminate these allocations for reflective expressions with zero parameters. This behavior is similar to the fast path implemented on https://bz.apache.org/bugzilla/show_bug.cgi?id=69381. Patch file attached. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org