<i18n dev> RFR: 8358880: Performance of parsing with DecimalFormat can be improved

Johannes Graham duke at openjdk.org
Mon Jun 9 17:16:02 UTC 2025


On Wed, 4 Jun 2025 18:18:39 GMT, Johannes Graham <duke at openjdk.org> wrote:

> This PR replaces construction of intermediate strings to be parsed with more direct manipulation of numbers. It also has a more streamlined mechanism of handling `Long.MIN_VALUE` when parsing longs by using `Long.parseUnsignedLong`
> 
> As a small side-effect it also eliminates the use of a cached StringBuilder in DigitList.
> 
> Testing:
> - GHA
> - Local run of tier 2 and jtreg:jdk/java/text
> - New benchmark: DecimalFormatParseBench

Rough performance results on AArch64 M4:



Original
Benchmark                                   Mode  Cnt      Score     Error   Units
-DecimalFormatParseBench.testParseDoubles  thrpt   15  15200.984 ± 409.547  ops/ms
-DecimalFormatParseBench.testParseLongs    thrpt   15  25777.899 ± 559.096  ops/ms

This PR
Benchmark                                   Mode  Cnt      Score     Error   Units
+DecimalFormatParseBench.testParseDoubles  thrpt   15  28041.325 ± 472.657  ops/ms
+DecimalFormatParseBench.testParseLongs    thrpt   15  34181.146 ± 655.719  ops/ms

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

PR Comment: https://git.openjdk.org/jdk/pull/25644#issuecomment-2940975486


More information about the i18n-dev mailing list