Not sure if it’s worth it, but you could avoid creating a new array with each iteration by assigning the current exterior to a reusable global length-1 array.