[Numpy-discussion] announce: pyjit, a little jit for creating numpy ufuncs

David M. Cooke cookedm at physics.mcmaster.ca
Mon Apr 24 13:18:05 CDT 2006

Simon Burton <simon at arrowtheory.com> writes:

> Hi,
> Inspired by numexpr, pypy and llvm, i've built a simple 
> JIT for creating numpy "ufuncs" (they are not yet real ufuncs).
> It uses llvm[1] as the backend machine code generator.

Cool! I had a look at LLVM, but I wanted something to go into SciPy,
and that was too heavy a dependence. However, I could see doing more
stuff with this than I can easily with numexpr.

> The main things it can do are:
>  *) parse simple python code (function def's)
>  *) generate SSA assembly code for llvm
>  *) build ufunc code for applying to numpy array's
> When I say simple I mean it:
> def calc(a,b):
>   c = (a+b)/2.0
>   return c
> No control flow or type inference has been implemented.
> As with numexpr, significant speedups are possible.
> I'm putting this announce here to see what the other numpy'ers think.
> $ svn co http://rubis.rsise.anu.edu.au/local/repos/elefant/pyjit
> [1] http://llvm.org/

How do the speedups compare with numexpr?

Are there any lessons you learned from this that could apply to

Could we have a common frontend for numexpr/pyjit, and a different
backend for each? Then each wouldn't have to reinvent the wheel in
parsing (the same thought goes with weave, too...)

I don't have much time to look at it (real life sucking my time :-(),
but I'll have a look when I do have the time.

|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca

More information about the Numpy-discussion mailing list