How to improve performance in nested loops

use a view here: sum(@view(arr[i:i+r])).

try to remove all allocations which are not completely on purpose.

3 Likes