RFR: 8315968: Consolidate java.util.Digits and StringLatin1::PACKED_DIGITS [v18]
Claes Redestad
redestad at openjdk.org
Tue Sep 12 10:14:42 UTC 2023
On Tue, 12 Sep 2023 01:00:39 GMT, 温绍锦 <duke at openjdk.org> wrote:
>> Some codes in core libs are duplicated, including:
>> java.util.DecimalDigits::DIGITS -> java.lang.StringLatin1.PACKED_DIGITS
>> java.util.DecimalDigits::size -> java.lang.Long.stringSize
>>
>> We can reduce duplication through JavaLangAccess, which is also needed in other places, such as:
>> https://github.com/openjdk/jdk/pull/15555
>
> 温绍锦 has updated the pull request incrementally with one additional commit since the last revision:
>
> little-endian
Running some additional testing. This mostly looks fine.
One issue is that you're swapping the byte-order in `DecimalDigits::DIGITS` but not in `OctalDigits` and `HexDigits`. I think we need to keep these internally consistent to avoid surprises.
I also would like to see performance numbers of the byte order swap evaluated in isolation. I suspect the real effect is small and might be due to JIT noise rather than a real effect, and that this swap got rushed in without solid evidence that it helps.
If there's no significant performance difference I would prefer if we kept `DecimalDigits::DIGITS` big-endian encoded - which is more intuitive to most - and adjust code depending on `DecimalDigits::digitPair` to use `ByteArray` rather than `ByteArrayLittleEndian`.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15651#issuecomment-1715419335
More information about the security-dev
mailing list