[11] RFR: 8197849: Misc improvements to URL parsing

Claes Redestad claes.redestad at oracle.com
Wed Feb 14 15:30:03 UTC 2018


Hi,

as a means to improve startup in some applications, please review this 
set of small improvements to improve both interpreted and compiled 
performance of creating and handling certain jar URLs. Some of the 
changes in sun.net.www.ParseUtil::encodePath have a small, positive 
effect when dealing with other types of path resources.

Bug: https://bugs.openjdk.java.net/browse/JDK-8197849

Webrev: http://cr.openjdk.java.net/~redestad/8197849/jdk.00/

This shaves off a percent or so of the total bytecode execution in a few 
of our startup tests:

- ParseUtil::encodePath cost is reduced ~20% during startup, averaging 
~10-15% faster for typical inputs after JIT. Weird examples like paths 
only consisting of slashes and dots can be seen to take a small hit due 
to not getting special treatment.

- ParseUtil::canonizeString cost on startup reduced by 50% (~15% 
improvement after JIT) for typical inputs by adding a test to return 
directly if there's no need to "canonize" the string (which is typically 
always the case for well-formed jar files). I added a sanity test to 
ensure I didn't accidentally change semantics of cases that would lead 
to canonicalization.

- Removed a couple of unnecessary allocation in 
sun.net.www.protocol.jar.Handler. Maybe there are some good reasons not 
to make ParseUtil a final utility class with only static methods and a 
private constructor, though...

Thanks!

/Claes


More information about the net-dev mailing list