https://bz.apache.org/bugzilla/show_bug.cgi?id=69659
Bug ID: 69659 Summary: Automatic JSP EL optimization Product: Tomcat 9 Version: 9.0.98 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P2 Component: Jasper Assignee: dev@tomcat.apache.org Reporter: jeng...@apache.org Target Milestone: ----- The majority of my application's EL statements contain wasteful empty checks, added by well-intended engineers who wanted to prevent NPEs. Example: ${not empty availability && not availability.hasError && not empty availability.primary && availability.primary.type == 'Whatever'} Since EL inherently handles nulls, those checks are unnecessary, and the example above could instead be: ${not availability.hasError && availability.primary.type == 'Whatever'} I modified the existing benchmark TestELParserPerformance to support these two queries and found the shorter one performs 40% faster. The gains come from fewer nodes and less reflection, as demonstrated in #69338 and #69381. Educating our engineers and modifying our entire codebase is impractical, so I'd like to modify Tomcat to automatically optimize the statements during JSP code generation. The statements are functionally equivalent so this could be an always-on feature. Specifically, I'd create ELOptimizer.optimize(statement) or similar, to be called by Generator; however I'm unsure of the best way to build that logic. A single rule like we have here could be implemented a dozen different ways, but we may want to add more in the future. Is a simple implementation enough for now or should we invest in an optimizing compiler of some sort? -- 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