Comparing Python, Julia, and C++

If preallocation is a fair strategy, you can use the out parameter from Numpy like numpy.add(x1, x2, out=r) to eliminate all the intermediate arrays: numpy.add — NumPy v1.23 Manual

1 Like