On julialang.org, it is stated that Julia is about 170 times faster than 
Mathematica for the the test "fib".  I get about a factor 2.

Julia:

fib(n) = n < 2 ? n : fib(n-1) + fib(n-2)
println(@time(fib(20)))

elapsed time: 0.001868071 seconds (33280 bytes allocated)
6765


Mathematica:


In[1]:= AbsoluteTiming[fib = 
Compile[{{n,_Integer}},If[n<2,n,fib[n-1]+fib[n-2]]]]
Out[1]= {0.000134563,CompiledFunction[Argument count: 1
Argument types: {_Integer}]}



In[2]:= AbsoluteTiming[fib[20]]
Out[2]= {0.00385017,6765}




Reply via email to