6 ms·
Briefly: yes, you generate lots of temporary arrays, but it is not slow because it often allows the use of vector instructions and parallelism, it can be faster
by omaranto 3y ago
Briefly: yes, you generate lots of temporary arrays, but it is not slow because it often allows the use of vector instructions and parallelism, it can be faster than a constant-memory loop that does not take advantage of vectorization or parallelization. Also note that most array language implementations reuse temporary arrays a lot doing in-place modification when possible.
If the necessary temporary arrays are really huge, array programmers will just do the computation in chunks that fit comfortably in memory.