[SciPy-user] Speed differences in sqrt calculation: what is good to know

Ivo Maljevic ivo.maljevic@gmail....
Thu Jun 12 10:05:45 CDT 2008


It looks like the same topic, that is, the difference in speed between numpy
and scipy.

There are all sorts of differences that I'm seeing while learning
scipy/numpy/python. Also an interesting one,
but probably with negligible impact:

In [1]: import math
In [2]: %timeit math.sqrt(2.2)
1000000 loops, best of 3: 327 ns per loop
In [3]: %timeit math.sqrt(2.2)
1000000 loops, best of 3: 321 ns per loop
In [4]: %timeit math.sqrt(2.2)
1000000 loops, best of 3: 323 ns per loop

versus:

In [1]: from math import sqrt
In [2]: %timeit sqrt(2.2)
1000000 loops, best of 3: 245 ns per loop
In [3]: %timeit sqrt(2.2)
1000000 loops, best of 3: 248 ns per loop
In [4]: %timeit sqrt(2.2)
1000000 loops, best of 3: 248 ns per loop



2008/6/12 Lubos Vrbka <lists@vrbka.net>:

> hi,
>
> slightly off-topic, but still regarding the speed differences... what's
> the difference between the following 2 functions?
>
> numpy.linalg.solve
> scipy.linalg.solve
>
> the first is almost 2 times faster on the same data (4096 repetitions of
> a A*a = b problem with A = 2x2 float32 matrix) - typically 0.30 vs. 0.57
> sec for the whole operation...
>
> best,
>
> --
> Lubos _@_"
> http://www.lubos.vrbka.net
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080612/d3c35c67/attachment.html 


More information about the SciPy-user mailing list