Rewrite naively with typed arrays.