4 ms·
Calling out to array libraries in an interpreter (Python+Numpy, MATLAB, whatever) leaves a lot of optimizations on the table. The abstraction is not zero-cost.
by snicker7 6y ago
Calling out to array libraries in an interpreter (Python+Numpy, MATLAB, whatever) leaves a lot of optimizations on the table. The abstraction is not zero-cost.
For example, the simple array expression v+cw (where v,w are vectors and c is a scalar) can be calculated using fused multiply-add instructions. But this is not possible when called in an interpreter, which has to make separate calls for each array operation. For the same reason, this same calculation may saturate the memory bus. This is not an issue with Julia or other compiled languages. Not sure how Numba and/or PyPy optimizes it.