RFR: 8314774: Optimize URLEncoder [v10]

Claes Redestad redestad at openjdk.org
Wed Sep 6 13:40:42 UTC 2023


On Wed, 6 Sep 2023 12:34:23 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> Glavo has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Remove unused import
>
> src/java.base/share/classes/java/net/URLEncoder.java line 140:
> 
>> 138:     }
>> 139: 
>> 140:     private static void encodeByte(StringBuilder out, byte b) {
> 
> This routine is basically 
> 
> out.append('%');
> HexFormat.of().withUpperCase().toHexDigits(out, b);
> 
> If this doesn't perform as well (with or without `HexFormat.of().withUpperCase()` cached in a static field) then that might be worth looking into.

I took a look at `HexFormat` and found that performance could be touched up a notch: #15591

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15354#discussion_r1317299940


More information about the net-dev mailing list