title: Is the Julia language really as fast as it claims?
body: <p>Following <a href="http://www.walkingrandomly.com/?p=5043" rel="noreferrer">this post</a> I decided to benchmark Julia against GNU Octave and the results were inconsistent with the speed-ups illustrated in <a href="http://julialang.org" rel="noreferrer">julialang.org</a>.</p>
  
  <p>I compiled both Julia and GNU Octave with <code>CXXFLAGS='-std=c++11 -O3'</code>, the results I got:</p>
  
  <h2>GNU Octave</h2>
  
  <pre><code>a=0.9999;
  
  tic;y=a.^(1:10000);toc
  Elapsed time is 0.000159025 seconds.
  
  tic;y=a.^(1:10000);toc
  Elapsed time is 0.000162125 seconds.
  
  tic;y=a.^(1:10000);toc
  Elapsed time is 0.000159979 seconds.
  </code></pre>
  
  <p>--</p>
  
  <pre><code>tic;y=cumprod(ones(1,10000)*a);toc
  Elapsed time is 0.000280142 seconds.
  
  tic;y=cumprod(ones(1,10000)*a);toc
  Elapsed time is 0.000280142 seconds.
  
  tic;y=cumprod(ones(1,10000)*a);toc
  Elapsed time is 0.000277996 seconds.
  </code></pre>
  
  <h2>Julia</h2>
  
  <pre><code>tic();y=a.^(1:10000);toc()
  elapsed time: 0.003486508 seconds
  
  tic();y=a.^(1:10000);toc()
  elapsed time: 0.003909662 seconds
  
  tic();y=a.^(1:10000);toc()
  elapsed time: 0.003465313 seconds
  </code></pre>
  
  <p>--</p>
  
  <pre><code>tic();y=cumprod(ones(1,10000)*a);toc()
  elapsed time: 0.001692931 seconds
  
  tic();y=cumprod(ones(1,10000)*a);toc()
  elapsed time: 0.001690245 seconds
  
  tic();y=cumprod(ones(1,10000)*a);toc()
  elapsed time: 0.001689241 seconds
  </code></pre>
  
  <p>Could someone explain why Julia is slower than GNU Octave with these basic operations? After warmed, it should call LAPACK/BLAS without overhead, right?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>As explained in the comments and answers, the code above is not a good benchmark nor it illustrates the benefits of using the language in a real application. I used to think of Julia as a faster "Octave/MATLAB", but it is much more than that. It is a huge step towards <em>productive</em>, high-performance, scientific computing. By using Julia, I was able to 1) outperform software in my research field written in Fortran and C++, and 2) provide users with a much nicer API.</p>