[SciPy-user] about weave performance evaluation

Prabhu Ramachandran prabhu_r at users.sf.net
Mon Oct 31 13:07:24 CST 2005


>>>>> "Dan" == Dan Christensen <jdc at uwo.ca> writes:

    >> 1- i don't understand the 25 fold increase of the last sentence
    >> of the cited text. Shouldn't we conclude that the use of
    >> numeric speeds up by a factor 100?

    Dan> I think 25 is correct.  When the numeric method gets err <
    Dan> eps, it will be farther from the correct solution than when
    Dan> the pure python method gets err < eps, since it is in effect
    Dan> taking smaller steps.  To get as accurate an answer, you'd
    Dan> have to adjust eps to make the code run approximately twice
    Dan> as long.

Just to explain this a little more clearly, the issue is that the pure
Python code will converge (in terms of number of iterations taken)
twice as fast as the Numeric code.  I.e. if the pure Python code takes
x iterations to converge, the Numeric code will take 2*x iterations
(because it uses temporaries).  Therefore, if you want to compare the
time taken for convergence, then you will end up with only a 25 fold
speed increase instead of the 50 fold increase.  If OTOH, you merely
want to compare the time taken for 1 single iteration then you get a
50 fold speed increase by using Numeric arrays.

    >> 2- in the final comparison the time used by numeric is
    >> 29.3s. If we want to compare the performance between the
    >> different implementations, should we divide this time by 2 ?

It depends.  If the timing criterion is convergence to a particular
error then divide by 2.  If it is just to measure pure performance of
100 iterations on a 500x500 problem then the number should be left as
such.  My intention was to just show pure performance so readers get a
feel for the kind of speed improvement they get with different options
for a similar calculation.

cheers,
prabhu



More information about the SciPy-user mailing list