Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
require 'benchmark' require 'rubygems' require 'active_support' class X def return_by_returning returning i = 0 do end end def return_by_return i = 0 return i end def return_by_omission i = 0 i end end t = X.new TESTS = 1_000_000 Benchmark.bmbm do |results| results.report("def n; i = 0; return i; end") { TESTS.times { t.return_by_return } } results.report("def n; i = 0; i ; end") { TESTS.times { t.return_by_omission } } results.report("def n; returning i = 0 do; end; end") { TESTS.times { t.return_by_returning } } end
This paste will be private.
From the Design Piracy series on my blog: