24

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.

Suraj
  • 35,905
  • 47
  • 139
  • 250
  • 1
    It means that it finds numpy but not numpy.lingalg, but has numpy module module. It is most likely an install problem or version compatibility difference or numpy incompatibilities. I suggest you directly contact Numpy PyPy implementation authors. Full code and full tracebacks for the errors would be very useful to solve this problem. – Mikko Ohtamaa May 27 '12 at 16:33
  • I'm not certain I have Numpy pypy installed. I cloned the repo and tried running setup.py in root and in /core. in root I'm told that I'm running the wrong setup. in core I get an ImportError: No module named genapi. I tried to install the module via pip but it could not be found. – Suraj May 27 '12 at 16:48
  • 7
    I would love to see this comparison if someone can get it to work. – StefanKarpinski May 27 '12 at 18:32
  • 2
    See http://buildbot.pypy.org/numpy-status/latest.html, linalg is not supported ATM. @StefanKarpinski: would you be interested in a rewrite to get it working with whatever PyPy supports today? BTW, here's the RFE in their tracker: https://bugs.pypy.org/issue915 – TryPyPy May 27 '12 at 19:38

2 Answers2

26

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.

Esteemator
  • 107
  • 7
Diego Javier Zea
  • 876
  • 10
  • 12
  • 20
    Nice stuff, Diego. Although I'm not entirely sure how this translates as "Julia and PyPy have the same performance". This looks a lot like "Julia always wins and often by quite a lot" ;-) – StefanKarpinski May 07 '13 at 16:22
  • I had tested a mathematic test by calculating factorial instead of fib. From this test, I got a result that CPython is a little faster than Pypy. I don't really know why mathematical performance of CPython is better than Pypy. – Kyokook Hwang Jun 13 '13 at 02:59
5

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?

fijal
  • 3,190
  • 18
  • 21
  • 3
    I cannot argue that my curiosity about pypy v. julia is higher priority than what you already have scheduled =) Maybe others are blocked by linalg and can chime in. Or per @TryPyPy suggestion the julia perf code can be re-written with whatever PyPy supports today – Suraj May 29 '12 at 15:33
  • it's slightly more compelx. PyPy numpy support is not only unfinished, but also the performance is not completely what I would like it to be. So even if you can run the benchmarks, it's not clear to me I would be happy (now) with the results. So it's a bit complicated process overall :) – fijal May 29 '12 at 15:58