On Thu, 31 Oct 2024 17:24:23 GMT, Quan Anh Mai <qa...@openjdk.org> wrote:

> For some reasons, the compiler really dislikes the unsafe loop.

On my slower machine, the difference between the variants is bigger:


Benchmark                                Mode  Cnt  Score   Error  Units
LoopOverRandom.segment_loop              avgt   15  3.727 ± 0.063  us/op
LoopOverRandom.segment_loop_all          avgt   15  2.813 ± 0.100  us/op
LoopOverRandom.segment_loop_asUnchecked  avgt   15  2.674 ± 0.051  us/op
LoopOverRandom.unsafe_loop               avgt   15  2.785 ± 0.068  us/op


As you observed, `unsafe_loop` gives odd numbers. (on paper should be the 
fastest).

-------------

PR Comment: https://git.openjdk.org/jdk/pull/21810#issuecomment-2450460577

Reply via email to