Vectorized code is usually faster in interpreted environments such as Matlab and numpy, because vectorized versions often (but not always) run precompiled and optimized code written in C or FORTRAN. Concurrent execution may or may not play a role in this.
Using vectorization in numpy usually results in better performance for this reason - often routines are compiled with C or FORTRAN, which run much faster than native Python code that must be executed on the interpreter. In addition, numpy, written primarily in C, can bypass the locking of the global python interpreter, which can significantly improve responsiveness in python code that uses threads.
source share