Created
November 29, 2013 13:34
Revisions
-
akshay-vishnoi created this gist
Nov 29, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ # ruby 2.0.0-p247 require 'benchmark' def old_method(&block) yield end def new_method yield end TIMES = 500_000 Benchmark.bmbm do |b| b.report('old') do TIMES.times do old_method { 'abc' } end end b.report('new') do TIMES.times do new_method { 'abc' } end end end Rehearsal --------------------------------------- old 0.590000 0.020000 0.610000 ( 0.615266) new 0.160000 0.000000 0.160000 ( 0.159566) ------------------------------ total: 0.770000sec user system total real old 0.570000 0.020000 0.590000 ( 0.584801) new 0.130000 0.000000 0.130000 ( 0.131258)