RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset) [v3]
Сергей Цыпанов
github.com+10835776+stsypanov at openjdk.java.net
Thu Jan 14 13:56:04 UTC 2021
On Wed, 13 Jan 2021 13:48:40 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> Сергей Цыпанов has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>>
>> - Merge branch 'master' into enc
>> - 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset) - small JavaDoc fix
>> - Merge branch 'master' into enc
>> - Merge branch 'master' into enc
>> - Improve URLEncoder.encode(String, Charset)
>
> Looks good.
>
> I wonder... `CharArrayWriter` is an old and synchronized data structure, and since the instance used here isn't shared that synchronization seem useless. And since you're now bypassing the `char[]` and going straight for a `String` you might get better performance with a `StringBuilder` here? (`setLength(0)` instead of `reset()`...)
@cl4es done
-------------
PR: https://git.openjdk.java.net/jdk/pull/1598
More information about the net-dev
mailing list