import timeit
timeit.timeit('np.linalg.norm(x)', setup=
    'import numpy as np; x = np.arange(100)', number=1000)
timeit.timeit('np.sqrt(x.dot(x))', setup=
    'import numpy as np; x = np.arange(100)', number=1000)
How do you get the magnitude of a vector in Numpy?