RFR: 8359424: Eliminate table lookup in Integer/Long toHexString

ExE Boss duke at openjdk.org
Sat Jun 14 16:47:29 UTC 2025


On Tue, 7 Jan 2025 10:39:18 GMT, Shaojin Wen <swen at openjdk.org> wrote:

> In PR #22928, UUID introduced long-based vectorized hexadecimal to string conversion, which can also be used in Integer::toHexString and Long::toHexString to eliminate table lookups. The benefit of eliminating table lookups is that the performance is better when cache misses occur.

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

> 470: 
> 471:         // Although the UUID byte ordering is defined to be big-endian, ByteArrayLittleEndian is used here to optimize
> 472:         // for the most common architectures. hex8 reverses the order internally.

No longer the case:
Suggestion:

        // Although the UUID byte ordering is defined to be big-endian, ByteArrayLittleEndian is used here to optimize
        // for the most common architectures.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22942#discussion_r2147022803


More information about the core-libs-dev mailing list