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

Johannes Graham duke at openjdk.org
Wed May 21 00:37:52 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 469:

> 467:         buf[18] = '-';
> 468:         buf[23] = '-';
> 469: 

I would suggest a comment here along the lines of "Although the UUID byte ordering is defined to be big-endian, LittleEndian is used here to optimize for the most common architectures. `hex8` reverses the order internally."

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

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


More information about the core-libs-dev mailing list