Try putting everything in a function.

http://julia.readthedocs.org/en/latest/manual/performance-tips/

-viral

On Saturday, November 22, 2014 6:16:39 PM UTC+5:30, Ronald L. Rivest wrote:
>
> 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
>

Reply via email to