On Tue, 19 Sep 2023 01:35:49 GMT, 温绍锦 <d...@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