RFR: 8343962: [REDO] Move getChars to DecimalDigits [v6]

Raffaello Giulietti rgiulietti at openjdk.org
Mon Jan 20 16:04:36 UTC 2025


On Sat, 18 Jan 2025 00:58:36 GMT, Shaojin Wen <swen at openjdk.org> wrote:

>> Sorry, I was just reading the comment and not how DIGITS is initialized and used.
>> 
>> The _correct_ comment should be something like
>> 
>>      *      97 -> '9' | ('7' << 8) -> 0x3739
>> 
>> so the `short` value was correct before, but not the expression to construct it.
>> Again, sorry for the confusion.
>
> It was my mistake. I made the change without checking it carefully. It has been fixed.

Thanks @wenshao.

I ran the benchmarks on a Apple M1 CPU. I can observe a performance increase for the Latin1 cases but _not_ for the Utf16 cases, which is the same within the error bounds.


before
StringBuilders.appendWithIntLatin1            N/A  avgt   15  181.071 ± 2.392  ns/op
StringBuilders.appendWithIntUtf16             N/A  avgt   15  160.507 ± 7.902  ns/op
StringBuilders.appendWithLongLatin1           N/A  avgt   15  232.727 ± 2.879  ns/op
StringBuilders.appendWithLongUtf16            N/A  avgt   15  222.765 ± 3.208  ns/op

after
StringBuilders.appendWithIntLatin1            N/A  avgt   15  129.019 ± 0.097  ns/op
StringBuilders.appendWithIntUtf16             N/A  avgt   15  166.260 ± 2.144  ns/op
StringBuilders.appendWithLongLatin1           N/A  avgt   15  192.300 ± 1.520  ns/op
StringBuilders.appendWithLongUtf16            N/A  avgt   15  219.962 ± 0.850  ns/op


Can you please rerun the benchmarks on your platforms and report here?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22023#discussion_r1922611115


More information about the core-libs-dev mailing list