RFR: 8316426: Optimization for HexFormat.formatHex [v6]
Roger Riggs
rriggs at openjdk.org
Tue Sep 19 14:10:42 UTC 2023
On Tue, 19 Sep 2023 01:35:49 GMT, 温绍锦 <duke at openjdk.org> wrote:
>> The original (and current) is coded to avoid a condition inside the loop.
>
> I also think that the way of writing for_0 combined with if > 0 is easier to understand, The operation overhead of if > 0 is very small, and it will not affect performance when used in a loop.
The coding pattern to handle first and last special cases outside the loop is also common and may help the JIT with loop unrolling and other optimizations. (And yes JITs can recognize all kinds of code and optimize it anyway).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15768#discussion_r1330195203
More information about the core-libs-dev
mailing list