-
-
Save lcowell/3a63edecad51177857ec to your computer and use it in GitHub Desktop.
Revisions
-
lcowell created this gist
May 30, 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,31 @@ require 'benchmark' class Chainer def punt self end end def trailer eval(trailer_code) end def trailer_code 1000.times.inject("@chainer") {|code, _| code << ".\npunt"} end def next_line eval(next_line_code) end def next_line_code 1000.times.inject("@chainer") {|code, _| code << "\n.punt"} end count = 10000 @chainer = Chainer.new Benchmark.bmbm do |x| x.report("next list") { 100.times { next_line } } x.report("trailing dot") { 100.times { trailer } } end