I'm a julia newbie trying to get a sense of how efficient the Julia compiler is, for a very simple little program. I attach copies of foo.py and foo.jl, which compute the same thing.
I then ran them (for the python version with both
pypy and with python). The results:
pypy: 2 seconds
julia: 30 seconds
python: 43 seconds
I was surprised to see julia so badly beaten by pypy,
and to see that the difference between julia and ordinary
python was less than a factor of two...
Is there an optimization trick or optimization switch that
I missed for Julia??
Thanks!
Cheers,
Ron Rivest
11:36:12 temp $ date; pypy foo.py; date
Fri Nov 21 23:36:22 EST 2014
0.726947459371
Done.
Fri Nov 21 23:36:24 EST 2014
11:36:24 temp $ date; julia foo.jl; date
Fri Nov 21 23:36:37 EST 2014
0.726947459370689
Done.Fri Nov 21 23:37:07 EST 2014
11:37:07 temp $ date; python foo.py; date
Fri Nov 21 23:37:32 EST 2014
0.726947459371
Done.
Fri Nov 21 23:38:15 EST 2014
n = 100000000
x = 0.234
for i in range(n):
x = max(x*x,1.0-x*x)
print(x)
print("Done.")
foo.jl
Description: Binary data
