On Fri, 8 Sep 2023 08:47:04 GMT, Raffaello Giulietti <rgiulie...@openjdk.org> wrote:
> I'm not sure that micro-benchmarks are very indicative on whether a lookup > table performs better than short and straightforward code. > The reason is that, once in the CPU caches, a lookup table in > micro-benchmarks stays there, whereas in more realistic situations, where > access is more spread out in time, it is often evicted to make room for > other, more lively data. > A micro-benchmark using a lookup table shows good results because of a high > rate of cache hits, whereas in other real-world workloads a lookup table > might result in many cache misses on access. In the HexFormat scenario, if the length of the input byte[] is larger, the performance of using the lookup table will be better. If the length of byte[] is greater than 1 in most scenarios, using lookup table will have better performance. ------------- PR Comment: https://git.openjdk.org/jdk/pull/15591#issuecomment-1712164869