The first thing you should do is run your code once to warm up the JIT, and then run it again to measure the actual run time, rather than compile time + run time. A convenient way to do this is to put your benchmark code inside a function, run the function once, then run it again using the @time macro. I might modify your code a bit to the following:
function LU_test() A = rand(1600, 1600); lu(A); end function FFT_test() n = 2^21; x = rand(1,n); fft(x); fft(x); end LU_test() FFT_test() println("LU") @time LU_test() println("FFT") @time FFT_test() Note that I am now measuring the amount of time necessary to calculate 2^21, which you weren't before, but that shouldn't matter at all. Try the above and see if there is any improvement. You may also want to read this section of the manual when writing more complicated codes; http://julia.readthedocs.org/en/latest/manual/performance-tips/ -E On Thu, Sep 18, 2014 at 11:45 AM, Stephan Buchert <stephanb...@gmail.com> wrote: > I have installed julia 0.3 from > http://copr.fedoraproject.org/coprs/nalimilan/julia/ > on my i7 Haswell 2.4 GHz laptop with updated Fedora 20. > > Then I translated the first two parts of the Matlab bench script to julia: > > # Transscript of the Matlab bench, > # only LU and FFT > # Transscript of the Matlab bench, > # only LU and FFT > print("LU decomposition, "); > tic(); > A = rand(1600, 1600); > lu(A); > toc(); > print("FFT , "); > n = 2^21; > tic(); > x = rand(1,n); > fft(x); > fft(x); > toc(); > > The comparison is relatively disastrous for julia: > julia> include("code/julia/bench.jl") > LU decomposition, elapsed time: 0.936670955 seconds > FFT , elapsed time: 0.208915093 seconds > (best out of 10 tries) > > Matlab r2014a > LU decomposition: 0.0477 seconds > FFT: 0.0682 seconds > > LU is 24 times slower on julia, FFT is 3 times slower. According to > system-monitor Matlab bench causes 3 cores to be busy, julia only 1. This > could explain the FFT result, but not the LU. > >