[Numpy-discussion] vectorizing loops
Mon Oct 29 12:53:05 CDT 2007
On 10/29/07, Christopher Barker <Chris.Barker@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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion