Skip to content

Instantly share code, notes, and snippets.

@lsdr
Created September 8, 2009 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsdr/183215 to your computer and use it in GitHub Desktop.
Save lsdr/183215 to your computer and use it in GitHub Desktop.
benchmarking Symbol#to_proc on Ruby 1.8.7 and 1.9.1
MAC OS X:
*** ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9.7.0]
user system total real
Symbol#to_proc 97.820000 26.180000 124.000000 (128.542748)
*** ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-darwin9.7.0]
user system total real
Symbol#to_proc 14.910000 0.100000 15.010000 ( 15.416481)
require 'benchmark'
require 'activesupport' if RUBY_VERSION == "1.8.7"
letters = %w(a b c d e f g h i j k l m n o p q r s t u v x w y z)
T = 1_000_000
Benchmark.bm(25) do |bm|
bm.report('Symbol#to_proc') { T.times { letters.collect!(&:upcase) } }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment