RFR: 8311207: Cleanup for Optimization for UUID.toString [v14]

Chen Liang liach at openjdk.org
Mon Sep 11 14:22:47 UTC 2023


On Mon, 11 Sep 2023 13:32:07 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> 温绍锦 has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   lo | hi => hi | lo
>
> I have run a couple of tests on linux Big Endian. They have passed. So, it's probably correct. However, I can't tell if it's good to use `ByteArrayLittleEndian`. I don't really like such platform details in the Java classes. Is that necessary for better performance on x86?

@TheRealMDoerr `ByteArrayLittleEndian` only means that the input long/int/short/char will be seen as little-endian when written to a byte array; do you mean that assuming little-endian writes are faster is too platform-specific?

An alternative approach tried before is to pack the digits platform-specifically and use Unsafe (which bypasses platform-endianness reversals) to write directly; I recall it was rejected before, for using unsafe directly seems... unsafe :)

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

PR Comment: https://git.openjdk.org/jdk/pull/14745#issuecomment-1713988224


More information about the core-libs-dev mailing list