<i18n dev> RFR: 8317980: Optimization for Integer.parseInt and Long.parseLong [v2]

Shaojin Wen duke at openjdk.org
Sat Jul 13 02:51:57 UTC 2024


On Sat, 13 Jul 2024 00:50:18 GMT, Shaojin Wen <duke at openjdk.org> wrote:

>> Currently, about 25% of the time spent by the Integer.parseInt and Long.parseLong methods is spent on the Character.digit method.
>> 
>> The Character.digit method is common to all radixes. We can use a digit method optimized for Latin1 encoding radix 10 to improve the performance of Integer.parseInt and Long.parseLong methods.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Reduce changes

The performance numbers are as follows

## MacBook M1 Pro

# baseline 
-Benchmark          (size)  Mode  Cnt  Score   Error  Units
-Longs.parseLong       500  avgt   15  2.613 ? 0.020  us/op
-Integers.parseInt     500  avgt   15  2.303 ? 0.006  us/op

+Benchmark          (size)  Mode  Cnt  Score   Error  Units
+Longs.parseLong       500  avgt   15  2.473 ? 0.020  us/op +5.66%
+Integers.parseInt     500  avgt   15  2.219 ? 0.002  us/op +3.78%


## MacBook 2018 i9

-Benchmark          (size)  Mode  Cnt  Score   Error  Units
-Integers.parseInt     500  avgt   15  3.114 ? 0.058  us/op
-Longs.parseLong       500  avgt   15  3.569 ? 0.059  us/op

+Benchmark          (size)  Mode  Cnt  Score   Error  Units
+Integers.parseInt     500  avgt   15  3.038 ? 0.033  us/op  +2.50%
+Longs.parseLong       500  avgt   15  3.065 ? 0.032  us/op +16.44%

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

PR Comment: https://git.openjdk.org/jdk/pull/20168#issuecomment-2226731713


More information about the i18n-dev mailing list