[SciPy-user] NumPy vs. SciPy and other speed comparisons
Wed Jun 11 08:40:27 CDT 2008
Thank you David. Few pointers:
1. You can use scipy's implementation of erfc() function. It will not make
the difference in relative results. That is:
from scipy.special import erfc
and than replace erfc.erfc with erfc
2. Robert discounted the speed difference observation as a nonsense that
keeps coming back because he saw "from scipy import *" statement. I believe
it would have been better if he looked at the numbers. When I change/reduce
the number of inner loops (test 2 case, where I make the vector longer), the
results for scipy and numpy are almost the same, which does not fit well
with his comments about how to import scipy/numpy.
You can easily exagarate the problem by reducing the FrameSize parameter to
10. The execution time difference becomes huge.
Then again, it is my mistake that I did not elaborate the
observation/"problem" more precisely.
Another interesting thing is that octave beats even C and Fortran when there
is effectively only one (snr) loop in the script. Could be that I am not
optimizing the C and Fortran code properly. I did use -O3 option, but octave
probably has randn function optimized, whereas I have a function that does a
lot of things just to produce a gaussian random number.
2008/6/11 David Cournapeau <firstname.lastname@example.org>:
> Ivo Maljevic wrote:
> > 2. I tried explicitly importing only the required functions, e.g,
> > from numpy import sqrt, arange, ones, zeros, random, where, ceil, sign
> > Agian, the same results.
> > Would the loading time of the two packages account for over 20 seconds
> > difference in execution time?
> No, I think the discussion carried away from your initial problem.
> Although importing scipy is slow, it certainly does not take 20
> seconds, unless you are running an ancient computer.
> Let me check your problem, which may just show that one function is
> scipy is much slower than a similar one in numpy.
> SciPy-user mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-user