Recursive fibonacci benchmark using top languages on GitHub
So... before looking at the code, I compared the elapsed time between the fib.rs program compiled with `rustc -O` and `rustc -O -C lto`. This yielded, interestingly, a ~500ms difference: ~6.45s vs ~6.95s (with LTO winning).<p>Then I looked at the code, and it began to make no sense. Then I looked at the assembly, and it made even less sense: the main function, fib::fib, which is where the vast majority of the time is spent, is identical, except for addresses.<p>I was starting to think, well, this might be related to instruction-cache lines... and it looks like it&#x27;s not that:<p><pre><code>  $ perf stat .&#x2F;fib-lto
  2971215073

   Performance counter stats for &#x27;.&#x2F;fib&#x27;:

         6474.410894      task-clock (msec)         #    1.000 CPUs utilized          
                  17      context-switches          #    0.003 K&#x2F;sec                  
                   0      cpu-migrations            #    0.000 K&#x2F;sec                  
                 112      page-faults               #    0.017 K&#x2F;sec                  
      22,607,598,238      cycles                    #    3.492 GHz                    
      55,325,512,417      instructions              #    2.45  insn per cycle         
      13,021,149,180      branches                  # 2011.171 M&#x2F;sec                  
          76,737,179      branch-misses             #    0.59% of all branches        

         6.474991613 seconds time elapsed

         6.474816000 seconds user
         0.000000000 seconds sys


  $ perf stat .&#x2F;fib
  2971215073

   Performance counter stats for &#x27;.&#x2F;fib&#x27;:

         6956.534790      task-clock (msec)         #    1.000 CPUs utilized          
                  11      context-switches          #    0.002 K&#x2F;sec                  
                   0      cpu-migrations            #    0.000 K&#x2F;sec                  
                 113      page-faults               #    0.016 K&#x2F;sec                  
      24,290,924,647      cycles                    #    3.492 GHz                    
      55,325,864,841      instructions              #    2.28  insn per cycle         
      13,021,213,404      branches                  # 1871.796 M&#x2F;sec                  
          84,392,454      branch-misses             #    0.65% of all branches        

         6.957260487 seconds time elapsed

         6.956974000 seconds user
         0.000000000 seconds sys

</code></pre>
I didn&#x27;t know an address difference of 0x30 could influence the number of branch misses so much.