8316681: Rewrite URLEncoder.encode to use small reusable buffers

Reviewed-by: dfuchs, rriggs
This commit is contained in:
Claes Redestad 2023-09-22 09:41:01 +00:00
parent bd2439f3fc
commit c24c66db97
4 changed files with 82 additions and 19 deletions

View file

@ -190,4 +190,18 @@ public class URLEncodeDecode {
}
@Benchmark
public void testEncodeLatin1(Blackhole bh) throws UnsupportedEncodingException {
for (String s : testStringsEncode) {
bh.consume(java.net.URLEncoder.encode(s, StandardCharsets.ISO_8859_1));
}
}
@Benchmark
public void testDecodeLatin1(Blackhole bh) throws UnsupportedEncodingException {
for (String s : testStringsDecode) {
bh.consume(URLDecoder.decode(s, StandardCharsets.ISO_8859_1));
}
}
}