https://bz.apache.org/bugzilla/show_bug.cgi?id=69659
--- Comment #1 from Christopher Schultz <ch...@christopherschultz.net> --- An optimizing compiler won't add much because it can't really prove those things are true unless we teach it, which is probably not worth it. Even the JIT probably isn't able to figure out that it's duplicated effort because the logic is so "far apart" (separated by && but radically different execution paths). It would be best to perform these optimizations during compilation of the statement. I don't know enough about JSP compilation and EL evaluation to know when that kind of thing could happen, but conceptually, looking at the AST of the expression should allow you to perform some optimizations by replacing the complex expression with a simpler one. Specifically, look for things like this: not empty X && statement-involving-X The LHS is easy, but the RHS is not so easy, since it could be arbitrarily complex. Can we convince ourselves that: not empty X && *anything* can simply be replaced with: *anything* ? I think the answer is no, since "not empty X" might be the only time X is referenced: removing it would change the behavior, obviously. I'm not sure there really is a general solution for this kind of thing. Honestly, education your engineers doesn't sound like a high bar: I would do that. Modifying your entire code-base is of course another matter. How much mileage could you get out of a simple regex-style replacement that looks for very specific things like this? -- 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