RFR: 8316426: Optimization for HexFormat.formatHex
Claes Redestad
redestad at openjdk.org
Mon Sep 18 15:45:03 UTC 2023
On Fri, 15 Sep 2023 19:11:48 GMT, 温绍锦 <duke at openjdk.org> wrote:
> The byte[] length used by HexFormatBench is 512. In this scenario, the performance improvement of using table lookup is significant.
Is this a common use-case? I could see an argument that formatting small chunks is much more common, where users will experience relatively more cache misses from the table lookup.
The gain from specializing for `StringBuilder` is impressive. My guess is that most of the gain is from enabling better loop optimizations by turning a complicated loop with interface calls into a simple counted loop over a byte[]. This could be split out into a separate PR, or perhaps we could consider more generalizable approaches to make `append` and `format` perform at the same level
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15768#issuecomment-1721772711
More information about the core-libs-dev
mailing list