[Python-Dev] [numpy wishlist] Interpreter support for temporary elision in third-party classes

Sturla Molden sturla.molden at gmail.com
Sat Jun 7 04:18:35 CEST 2014


Nathaniel Smith <njs at pobox.com> wrote:

>> with numpy.accelerate:
>>     x = <expression>
>>     y = <expression>
>>     z = <expression>
>> # evaluation of x,y,z happens here
> 
> Using an alternative evaluation engine is indeed another way to
> optimize execution, which is why projects like numexpr, numba, theano,
> etc. exist. But this is basically switching to a different language in
> a different VM.

I was not thinking that complicated. Let us focus on what an unmodified
CPython can do.

A compound expression with arrays can also be seen as a pipeline. Imagine
what would happen if in "NumPy 2.0" arithmetic operators returned
coroutines instead of temporary arrays. That way an expression could be
evaluated chunkwise, and the chunks would be small enough to fit in cache.

Sturla



More information about the Python-Dev mailing list