Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
require 'benchmark' class Symbol def to_proc Proc.new { |*args| args.shift.__send__(self, *args) } end end BIG_ARRAY = [:abcdef] * 100000 Benchmark.bmbm do |x| x.report do BIG_ARRAY.map(&:to_s) end x.report do BIG_ARRAY.map { |e| e.to_s } end end $ ruby -v ruby 1.8.6 (2008-03-03 patchlevel 114) [i686-darwin9.2.0] $ ruby iter.rb Rehearsal ------------------------------------ 0.220000 0.010000 0.230000 ( 0.232931) 0.080000 0.000000 0.080000 ( 0.088338) --------------------------- total: 0.310000sec user system total real 0.200000 0.000000 0.200000 ( 0.197506) 0.050000 0.000000 0.050000 ( 0.065803)
This paste will be private.
From the Design Piracy series on my blog: