[Numpy-discussion] vectorizing loops

Timothy Hochberg tim.hochberg at ieee.org
Mon Oct 29 13:53:05 EDT 2007


On 10/29/07, Christopher Barker <Chris.Barker at noaa.gov> wrote:
>
> >> (incidently, the kind of things 'we' are doing seem like the most
> > simple things to JIT).
>
> Wouldn't a numpy-aware psyco be cool then?
>
> Oh well, I'm not going to write it!
>
> (though as I think about it, for the special case of a contiguous array,
> it would be awfully similar to an array.array --- hmmm.)


Psyco is aware of array.array and can operate on array.array's quite fast.
[In fact, somewhere I have a ndarray-like class based on Psyco that runs
pretty fast for integers, but not so fast for floats]. The problem that
Psyco has for numeric purposes is that it has no concept of floating point
numbers. It can "natively" store only a few different things: ints,
pointers, and arrays of ints or pointers. To put, for example, doubles, onto
the Psyco stack or into one of it's registers, you need to break the bits of
the double up, and stuff them into a couple of different int registers. Then
to operate on them you need to put them back together, since they may get
separated. All of this adds a fair amount of overhead.

I've been hoping that the PyPy jit will address this, but I haven't had time
to follow that project closely enough to see if that's on the agenda.



-- 
.  __
.   |-\
.
.  tim.hochberg at ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20071029/7897dc35/attachment.html>


More information about the NumPy-Discussion mailing list