Indeed, `w[ii]` can be cached outside the loop. You can also set `mode="C"` on the array declarations, but IME that usually doesn't buy a great deal of performance.