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

Roger Riggs rriggs at openjdk.org
Mon May 19 18:44:53 UTC 2025


On Sat, 5 Apr 2025 05:30:25 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:
> 
>   simplify code

Please update the performance comparisons (percentage improvement.)

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

> 489:      * hexadecimal representation, concatenate these hexadecimal strings into one continuous string, and then interpret
> 490:      * this string as a hexadecimal number to form and return a long value.
> 491:      */

Is there a reference describing this technique?  Such as the Hacker's Delight citation used in java.lang.Long?
If not a longer descriptive comment would be good for maintainability.

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

PR Review: https://git.openjdk.org/jdk/pull/22928#pullrequestreview-2851674685
PR Review Comment: https://git.openjdk.org/jdk/pull/22928#discussion_r2096283194


More information about the core-libs-dev mailing list