[Numpy-discussion] python numpy code many times slower than c++

Neal Becker ndbecker2 at gmail.com
Tue Jan 20 21:09:28 EST 2009


I tried a little experiment, implementing some code in numpy (usually I 
build modules in c++ to interface to python).  Since these operations are 
all large vectors, I hoped it would be reasonably efficient.

The code in question is simple.  It is a model of an amplifier, modeled by 
it's AM/AM and AM/PM characteristics.

The function in question is the __call__ operator.  The test program plots a 
spectrum, calling this operator 1024 times each time with a vector of 4096.

Any ideas?  The code is not too big, so I'll try to attach it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ampl.py
Type: text/x-python
Size: 2961 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090120/ff89353e/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: linear_interp.py
Type: text/x-python
Size: 851 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090120/ff89353e/attachment-0001.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_spectrum.py
Type: text/x-python
Size: 4618 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090120/ff89353e/attachment-0002.py>


More information about the NumPy-Discussion mailing list