[SciPy-user] Why is weave.inline()/blitz++ code 3 times slower than innerproduct()?

Fernando Perez fperez at colorado.edu
Wed Aug 20 22:12:03 EDT 2003


Robert Kern wrote:

> I tried your code with g++ 3.3.1, Python 2.3, Numeric 23.0, CVS SciPy on
> Debian Linux (kernel 2.4.21), Athlon XP 2100, 512 MB RAM. I tried to
> minimize other processes running.
> 
> My results with your pristine code aren't nearly as consistent as yours.

Actually, I think I understood what happened.  Your test times are actually 
very long, much more than I expected for your hardware.  Then I realized that 
you have half as much ram as I do, so you ended up in swap all the time.  So 
the actual computational differences got washed out by swap time.

This would also explain the inconsistencies you saw, which I didn't: 
depending on how much had to be swapped out, the times would change a lot.

I downloaded g++ 3.3.1 and reran my tests, and while things improved a bit, I 
still see the hand-written code about 2.5 times slower than Numpy's 
innerproduct() function.

If this is a fundamental limitation of the blitz approach, I'll be real unhappy.

I've re-included the timing.py script, modified to use a single parameter: how 
much memory to use.  The default is 300Mb, you can make it smaller.

I'd greatly appreciate it if you could repeat these tests and let me know what 
you get.  All the other code stays the same, so you can just type ./timing.py 
and send me the output :)

If anyonelse is willing to run these tests, I've also included the full 
tarball.  I'd be grateful for input on this.

For someone with scipy installed, it's as simple as

tar xzf py_inner.tgz
cd py_inner
make
./timing.py [M] -- for using M Mbytes of RAM, optional.  Default is 300

Then,
./timing.py [M]

a second time so that all the auto-building time from inline() calls doesn't 
happen.

Thanks for any assistance.

Regards,

Fernando.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: timing.py
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20030820/1d8a38ae/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: py_inner.tgz
Type: application/unix-tar
Size: 7259 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20030820/1d8a38ae/attachment.bin>


More information about the SciPy-User mailing list