title: Why Array.reverse_each is faster than Array.reverse.each
body: <p>I hardly use <code>reverse_each</code> method, instead I call upon <code>reverse.each</code> when I need to traverse an array backwards. So I just did some benchmarking and apparently <code>reverse_each</code> is significantly faster than <code>reverse.each</code>. </p>
  
  <ul>
  <li>Is this because there is an element of time associated with creating a reverse array before iterating through it when using <code>reverse.each</code>? </li>
  </ul>
  
  <p>However in my example (below) of 10 million iterations <code>TIME(reverse) + TIME(each) - TIME(reverse.each) ~ 1.2 seconds</code> for an array of size 4. And this time difference more or less stays stable irrespective of the size of array. I have tested it for upto 100 elements. </p>
  
  <ul>
  <li>What accounts for this one second difference?</li>
  </ul>
  
  <hr>
  
  <pre><code>require 'benchmark'
  
  number = 10000000
  arr = (1..4).to_a
  
  Benchmark.bm(13) do |x|
      x.report("reverse.each") { number.times { arr.reverse.each {|x| x} } }
      x.report("reverse_each") { number.times { arr.reverse_each {|x| x} } }
      x.report("reverse")      { number.times { arr.reverse } }             
      x.report("each")         { number.times { arr.each {|x| x} } }        
  end
  </code></pre>