Bug ID: 67080
           Summary: ImplicitObjectELResolverImpl.getValue() is slow
           Product: Tomcat 9
           Version: 9.0.x
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
  Target Milestone: -----

A high-volume, latency sensitive application reports that
`ImplicitObjectELResolverImpl.getValue()` uses approximately 0.2% of cpu, of
which most (0.18%) comes from the call to `Arrays.binarySearch` for an array of
strings.  This problem was previously noted on but the solution was
rejected for various reasons.

I instead propose replacing the binary search with a switch statement on the
string values.  This requires Java 7 and was not an option when the previous
issue was closed.

The attached speed test shows that the `switch` statement is approximately 66%
faster.  I don't think it matters but I ordered the case statements in a rough
approximation of their frequency in our application.

The attached speed test returns results such as the following:

Done with old in 1522
Done with old in 1636
Done with old in 1606
Done with old in 1641
Done with old in 1583
Done with old in 1587
Done with old in 1629
Done with old in 1627
Done with old in 1607
Done with old in 1569
Done with new in 474
Done with new in 453
Done with new in 450
Done with new in 452
Done with new in 449
Done with new in 450
Done with new in 454
Done with new in 452
Done with new in 459
Done with new in 447

You are receiving this mail because:
You are the assignee for the bug.
To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to