RFR: 8359424: Eliminate table lookup in Integer/Long toHexString
Hannes Greule
hgreule at openjdk.org
Fri Jun 13 12:07:21 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.
Running it on my machine (Ryzen 9 3900X):
baseline (91db7c0877a68ad171da2b4501280fc24630ae83):
Integers.toHexString 500 avgt 15 5.717 ± 0.274 us/op
Longs.toHexString 500 avgt 15 6.851 ± 0.214 us/op
this change (1788d09787cadfe6ec23b9b10bef87a2cdc029a3):
Integers.toHexString 500 avgt 15 21.334 ± 0.268 us/op
Longs.toHexString 500 avgt 15 38.907 ± 0.589 us/op
I know that this processor has an extremely slow implementation of the `PDEP` instruction, but I'm kinda surprised you're seeing better results on aarch64. But I think Zen1 and Zen2 should considered here to avoid regressions on those architectures.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22942#issuecomment-2577153462
More information about the core-libs-dev
mailing list