Since we're hyperoptimizing this, I think it's worth considering flipping x and y for these two arrays so that we're writing across the grain of the array (one operation per square) and reading with the grain of the array (three operations per square).