RFR [9] 8040747 : Improve performance of IP address parsing
Claes Redestad
claes.redestad at oracle.com
Fri Apr 18 22:38:33 UTC 2014
Hi,
could I get a review of the following patch to improve IP address
parsing performance?
http://cr.openjdk.java.net/~mduigou/JDK-8040747/0/webrev/
<http://cr.openjdk.java.net/%7Emduigou/JDK-8040747/0/webrev/>
https://bugs.openjdk.java.net/browse/JDK-8040747
A set of simple JMH benchmarks was created to test all supported and
some invalid formats. Results show a speed up of ~5-9x for the normal
cases (9x for simple cases like 0.0.0.0, 5x for longer addresses like
255.255.255.255), similar boosts for all invalid and rare cases while
profiling show that the TLAB allocation rates drop significantly using
the proposed algorithm.
Note: naturally maintaining compatibility with the standard and
non-standard formats intently supported by the previous implementation
(where both 127.0.0.1 and 40000000 would be considered valid IPv4
addresses), but I've omitted support for the use of explicit signs
(+127.+0.-0.+1 would work with the old parser) due to reliance on
Integer.parseInt to parse the octets; a few checks could be added to
keep supporting these unintended format variants at a small cost.
/Claes
More information about the net-dev
mailing list