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]
Rohitash
duke at openjdk.org
Wed Apr 16 09:46:59 UTC 2025
> `scanByte` throws `NumberFormatException` for URIs that start with numbers, e.g., https://11111111.x.y/
> The current flow is `parseIPv4Address` → `scanIPv4Address` → `scanByte`. `parseIPv4Address` uses `NumberFormatException` for control flow, so it captures the exception, ignores it, and returns -1. This has been reported by AWS customer to cause low performance. Details: [JDK-8353013](https://bugs.openjdk.org/browse/JDK-8353013) & https://github.com/aws/aws-sdk-java-v2/issues/5933
>
> This PR avoids NumberFormatException by skipping calls to `Integer.parseInt` if the number of digits in the octet is > 3.
>
>
> I ran following tests.
>
> make test-tier1
> make test-tier2
> make test TEST=jdk/java/net
Rohitash has updated the pull request incrementally with one additional commit since the last revision:
improve jmh benchmark
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/24295/files
- new: https://git.openjdk.org/jdk/pull/24295/files/07bff288..0164bcab
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=24295&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=24295&range=01-02
Stats: 12 lines in 1 file changed: 4 ins; 4 del; 4 mod
Patch: https://git.openjdk.org/jdk/pull/24295.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24295/head:pull/24295
PR: https://git.openjdk.org/jdk/pull/24295
More information about the net-dev
mailing list