1.Java Performance Tuning for loop unrolling/ unwinding.

preview_player
Показать описание
For. Most runtime in programs is spent in loops. The for-loop iterates over numbers. It is commonly used. It is ideal for processing known ranges.

For each. In Java no foreach keyword is used. Instead we use the for-keyword to iterate over each element in a collection. We do not need an index to do this.

Performance, loop unrolling. Sometimes loops are unnecessary. In loop unrolling, we change a loop to a list of statements. We can loop over groups of statements at once.
Note:
In this example we simply remove the entire loop and place the statements that need to be executed.

Unwinding:
Loop unrolling is sometimes called loop unwinding. It can improve, or reduce, performance—we must benchmark.
Рекомендации по теме
Комментарии
Автор

Good effort, but try warming up the VM before measurements taken. You have warmed cashes bit more for 2nd path i.e. it's not fair comparison.
You may consider using JMH framework and use blackhole. It's JVM mate ... keep trying.

pranasbaliuka