RFR: 8353013: java.net.URI.create(String) may have low performance to scan the host/domain name from URI string when the hostname starts with number [v3]

Daniel Fuchs dfuchs at openjdk.org
Wed Apr 16 15:49:56 UTC 2025


On Wed, 16 Apr 2025 13:03:31 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

>> Thanks! I have updated the comment and added a JMH benchmark.
>> 
>> 
>> ## Before
>> Benchmark                                                      (uri)  Mode  Cnt     Score    Error  Units
>> URIAuthorityParsingBenchmark.create  https://98765432101.abc.xyz.com  avgt   15  1495.273 ± 86.157  ns/op
>> URIAuthorityParsingBenchmark.create  https://ABCDEFGHIJK.abc.xyz.com  avgt   15   363.048 ±  6.510  ns/op
>> 
>> ## After
>> Benchmark                                                    Mode  Cnt    Score    Error  Units
>> Benchmark                                                      (uri)  Mode  Cnt    Score    Error  Units
>> URIAuthorityParsingBenchmark.create  https://98765432101.abc.xyz.com  avgt   15  377.741 ± 10.497  ns/op
>> URIAuthorityParsingBenchmark.create  https://ABCDEFGHIJK.abc.xyz.com  avgt   15  334.215 ±  2.148  ns/op
>
> Isn't is suspicious that non-number case got speedup too?

Not sure if we should consider a 30ns speed up in a single run of the benchmark on a single node as significant.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24295#discussion_r2047227114


More information about the net-dev mailing list