https://bz.apache.org/bugzilla/show_bug.cgi?id=67080

--- Comment #10 from Christopher Schultz <ch...@christopherschultz.net> ---
This test seems to show that there is indeed a speed improvement by using a
switch statement instead of a binary search, somewhere in the 30% range, and it
seems consistent. I didn't get the kind of speedup that John sees, but that may
be due to environmental differences.

Scope lookups probably occur many times in a given JSP, so this can probably
add-up, especially when seeing a report that this is a hot-spot.

In order to get a good randomized test where the JIT and/or CPU were not
cheating by discovering that we were e.g. always searching for
"applicationScope", I used java.util.Random.nextInt to randomly-choose one of
the scopes for each test. I did not check to see how much of the testing time
was taken up by the Random.nextInt invocation, but both compared methods are
using the same random technique.

I'm happy to receive a critique of my JMH test if it does not show what I think
it shows.

-- 
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

Reply via email to