RFR: 8260043: Reduce allocation in sun.net.www.protocol.jar.Handler.parseURL
Claes Redestad
redestad at openjdk.java.net
Wed Jan 20 15:36:53 UTC 2021
On Wed, 20 Jan 2021 15:25:18 GMT, eirbjo <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.
LGTM - just a small nit that you seem to have forgotten to change canonize to canonicalize in some places.
src/java.base/share/classes/sun/net/www/protocol/jar/Handler.java line 232:
> 230: }
> 231:
> 232: private static String doCanonize(String file) {
nit: doCanonicalize
-------------
Marked as reviewed by redestad (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/2167
More information about the net-dev
mailing list