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

Chen Liang liach at openjdk.org
Fri Jun 13 12:07:25 UTC 2025


On Tue, 7 Jan 2025 22:16:19 GMT, Francesco Nigro <duke 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/jdk/internal/util/HexDigits.java line 204:
> 
>> 202:      */
>> 203:     public static long hex8(long i) {
>> 204:         long x = Long.expand(i, 0x0F0F_0F0F_0F0F_0F0FL);
> 
> x86 should use  pepd - but aarch64?

Seems there is no good way to do so on aarch; raw shifts and going through VPU both seem to be slower.

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

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


More information about the core-libs-dev mailing list