RFR: 8353741: Eliminate table lookup in UUID.toString [v6]

Johannes Graham duke at openjdk.org
Wed May 21 00:29:55 UTC 2025


On Mon, 19 May 2025 23:53:07 GMT, Shaojin Wen <swen at openjdk.org> wrote:

>> Improve the performance of UUID::toString by using Long.expand and SWAR (SIMD within a register) instead of table lookup. Eliminating the table lookup can also avoid the performance degradation problem when the cache misses.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   hex8 comments

src/java.base/share/classes/java/util/UUID.java line 534:

> 532:      */
> 533:     private static long hex8(long i) {
> 534:         // Expand each 4-bit group into 8 bits, spreading them out in the long value: 0xAABBCCDD -> 0x0A0B0C0D0A0B0C0D

should be `0xAABBCCDD -> 0xA0A0B0B0C0C0D0D`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22928#discussion_r2099076402


More information about the core-libs-dev mailing list