[pypy-dev] How's the JIT coming along?
Carl Friedrich Bolz
cfbolz at gmx.de
Wed Aug 22 08:24:12 CEST 2007
Leonardo Santagada wrote:
> Em Aug 21, 2007, às 11:22 PM, David Cournapeau escreveu:
>> I cannot speak for Garry, but I myself would be interested in pypy for
>> numerical computing in python. Basically, there are cases where
>> numpy is
>> not enough and require coding in C. The two cases I am thinking are:
>> - recursive algorithms: this means many functions calls, which are
>> too expensive in python (eg: imagine you have a two buffers of many
>> float x, and you want to compute f(x[i], [y[i], nu[i]) = x[i+1] = x
>> [i] +
>> nu[i] * (x[i] - y[i]); even using ctypes for the trivial
>> computation in
>> C kills performances because of the many calls)
>> - algorithms which require many temporaries to be efficient in
>> numpy.
>>
>> Both of them, if my understanding is right, would be perfect
>> exemples of
>> easy to optimize using JIT.
>
> I'm guessing here, but to my knoledge to make python functions more
> lightweight using jit would only work by making tail call
> optimization, but for that you can also do the "same" optimization by
> using a explicit stack and not use function calls at all.
I don't have time to go into this right now, but you are guessing wrong.
With some sophistication you can also use the JIT to optimize normal
calls (even inline them, with enough effort). It would require some more
work, though.
Cheers,
Carl Friedrich
More information about the Pypy-dev
mailing list