[pypy-dev] Newcommer in pypy, numpy user

Michael Hudson mwh at python.net
Wed Dec 20 11:12:03 CET 2006

David Cournapeau <david at ar.media.kyoto-u.ac.jp> writes:

> Michael Hudson wrote:
>> David Cournapeau <david at ar.media.kyoto-u.ac.jp> writes:
>>>     I was wondering if pypy has some solution/new approaches to this 
>>> problem. For example, when using numpy, I would suspect that many 
>>> functions calls are 'static', that is always expect the same type of 
>>> arguments; also, for simple loop on integers, my understanding is that 
>>> JIT compilation has some nice solution to give to have much better 
>>> performances (matlab has a JIT compiler to make loop faster for 
>>> interpreted code).
>> It may be that the JIT is good for this sort of code.  It's not yet
>> though :-)
> I understand that pypy is still in (relative) infancy, but I have to 
> confess I am more and more interested in all those concepts of JIT, 
> etc... even if I don't know much outside the concept and the big picture.

It's definitely interesting stuff :-)

>> As far as I'm aware this was something else: teaching PyPy's annotator
>> to recognise code that uses Numeric arrays and the code generator how
>> to compile this to equivalent code that manipulates arrays at a lower
>> level.  This could be seen as an alternative to rewriting your code in
>> C.  I'm not sure what the state of this code is, but I don't think
>> it's very advanced.
> I am not familiar with the pypy vocabulary yet, so let me rephrase to be 
> sure I understand: the idea is to detect numpy arrays, and instead of 
> using C extension for fast computation, it would generate automatically 
> code  in the target language (let's say C for C generation) ?
> So for example, if a and b are numpy arrays, a python expression b *= a 
> would be translated in C by something like for(i = 0; i < b.size; ++i) 
> {b[i] *= a[i];} ?

Yes, I think that's a pretty good description.

> Is anyone working on that ?

Not that I know of.


  > say-hi-to-the-flying-pink-elephants-for-me-ly y'rs,
  No way, the flying pink elephants are carrying MACHINE GUNS!
  Aiiee!!  Time for a kinder, gentler hallucinogen...
                               -- Barry Warsaw & Greg Ward, python-dev

More information about the Pypy-dev mailing list