Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Julia's Python performance example in pypy

Tags:

Julia is a new statistical programming language that claims significantly better performance than competing languages. I'm trying to verify this. Julia has a performance test written in Python: https://github.com/JuliaLang/julia/blob/master/test/perf/perf.py

I can't get it to work with pypy. Perhaps this is due to numpypy incompatibilities with numpy, but I'm not getting far enough to determine that. I followed the ImportError advice "...or just write 'import numpypy' first in your program..." but I get another ImportError: "No module named numpy.linalg"

I have near zero experience with Python and I'm looking for a complete solution that I can run. The benefit of getting this to work is that we can we have a apples-to-apples (jit lang-to-jit lang) comparison.

like image 784
SFun28 Avatar asked May 27 '12 16:05

SFun28


2 Answers

Test of python and julia performance

There are 4 test on Julia git (perf.py) in pure Python. Here, I run, in the same computer, perf.py (only the pure Python test) and perf.pl for a apples-to-apples comparison. I'm a little worried for Python/Pypy timing :/

And... Why

## fibonacci ##  def fib(n):     if n<2:         return n     return fib(n-1)+fib(n-2) 

is slower in Pypy than in Python ?


I post this question in https://bugs.pypy.org/issue1344 [Pypy slower in recursion than Python2.7, Python3.2 and Julia] I get the next answer:

This is a situation where the warmup time is very significant (it tries to inline all the recursion), but once you warm it up it's actually very fast.

So, I do the text with different numbers of n for fib(n). Indeed, Pypy comes faster than Python with a n > 30, but in recursion is slower than Julia:

[ En bold the faster python implementation ]

Recursion in Pypy Python and Julia


Because are implemented with recursion, Quicksort and fib are slower in Pypy. Julia seems to be faster than PyPy.

like image 188
Diego Javier Zea Avatar answered Nov 01 '22 06:11

Diego Javier Zea


Linalg is not implemented as of now. I think a new ffi and getting 1.9 out of the door (which require quite a few numpy fixes, see the bug tracker) are getting top priority. I don't think having linalg right now is that interesting. We would like to have more of numpy running first. I'm open to be convinced though. Arguments?

like image 37
fijal Avatar answered Nov 01 '22 08:11

fijal