RFR: 8310929: Optimization for Integer.toString [v2]
温绍锦
duke at openjdk.org
Thu Jun 29 00:10:57 UTC 2023
On Wed, 28 Jun 2023 17:53:04 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:
>> 温绍锦 has updated the pull request incrementally with one additional commit since the last revision:
>>
>> postpone the division
>
> src/java.base/share/classes/java/lang/Integer.java line 478:
>
>> 476:
>> 477: byte[] buf;
>> 478: if (q1 == 0) {
>
> You could postpone the division to compute `q1` later, and here test whether `i < 1_000`.
> I've no statistics, but I guess it makes sense to optimize for tiny `int`s by avoiding a division.
I have submitted the changes and updated the benchmark results, which shows an improvement.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14699#discussion_r1245940981
More information about the core-libs-dev
mailing list