Hacker News new | ask | show | jobs
by alfanerd 3228 days ago
I just made a quick test: CPython-3.6.1 vs. Jython-2.7.0 (May 2015)

I ran Larry Hastings' Gilectomy testprogram x.py: fib(40) on 8 threads HW: MacBook Pro, 2015, 8 (4+4) cores, 1Gb RAM

Jython ran the program 8 times faster, utilising all 8 cores >95%. Python ran on 1-2 cores less than 60% utilisation. (Pretty sure Jython will run 16 times faster on 16 cores)

It's 2017, why this is acceptable to GvR and the Python community is beyond me.

Jython: real 1m4.959s user 7m38.521s sys 0m2.396s

Python: real 8m19.035s user 8m16.508s sys 0m11.424s

1 comments

Could you post the code for that fib program I couldn't find it anywhere.
It is in the Gilectomy branch of Larry Hastings github project. (https://github.com/larryhastings/gilectomy)

I also pasted the fib test to pastebin: https://pastebin.com/Ryyb2K7V

Ah so just the naive recursive fibonacci on 8 threads with no data sharing between them.

Interestingly doing the same on Cpython using the multiprocessing module was ~2x slower than jython/threads. More interestingly pypy with multiprocessing was ~5x faster than jython/threads.

  $ time jython fib.py 40
  real	1m11.247s
  user	6m14.130s
  sys	0m3.012s
  
  $ time python fib.py 40
  real	2m4.067s
  user	11m46.103s
  sys	0m2.352s
  
  $ time pypy fib.py 40
  real	0m21.040s
  user	1m51.461s
  sys	0m1.892s