RFR: 8260043: Reduce allocation in sun.net.www.protocol.jar.Handler.parseURL [v2]
Alan Bateman
alanb at openjdk.java.net
Thu Jan 21 10:00:55 UTC 2021
On Wed, 20 Jan 2021 15:46:13 GMT, Eirik Bjorsnos <github.com+300291+eirbjo at openjdk.org> wrote:
>> By moving string splitting and concatenation into the canonizeString utility, we can defer allocation until we determine that canonization is required. This saves two string allocations and a string concat for the common case where canonization is not required.
>>
>> As a refactoring, move ParseUtil.canonizeString/doCanonize into Handler since that's the only call site.
>>
>> Finally, let's rename the method to canonizalizeString, since canonization is an rather unrelated term.
>
> Eirik Bjorsnos has updated the pull request incrementally with one additional commit since the last revision:
>
> As a part of the rename from "canonize" to "canonicalize", doCanonize should also be renamed. This was an oversight in the original PR.
src/java.base/share/classes/sun/net/www/protocol/jar/Handler.java line 166:
> 164: file = parseContextSpec(url, spec);
> 165:
> 166: // Canonize the result after the bangslash
Maybe we can also replace "Canonize" in the comment while we are in the area.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2167
More information about the net-dev
mailing list