Created
September 8, 2009 20:53
-
-
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
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 characters
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) |
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 characters
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