1. 2
  1.  

  2. 2

    Strangely enough he didn’t benchmark method_one.

    Personally I prefer method_one since it has least magic.

    I don’t mind magic if it wins big…. but for tiny wins? Nah. The least magic solution please.

    1. 2

      You’re right, he didn’t. I was curious so I did. Here’s my benchmarking code. I got very close results with methods one and two:

      chrisj@scruffy ~/projects $ ruby benchmark.rb
                          user     system      total        real
      method one  3.050000   0.010000   3.060000 (  3.530709)
      method two  3.390000   0.000000   3.390000 (  3.635153)
      method three  4.120000   0.000000   4.120000 (  4.400589)
      
      1. 1

        Thanks.

        So I’m seeing no big wins in any direction…. So my personal preference will be for the least magic flavour method_one.