Skip to content

Instantly share code, notes, and snippets.

@jodosha
Created May 29, 2009 12:12
Show Gist options
  • Save jodosha/119923 to your computer and use it in GitHub Desktop.
Save jodosha/119923 to your computer and use it in GitHub Desktop.
require 'benchmark'
OK = "OK".freeze
Ok = "OK".freeze
Benchmark.bm(30) do |b|
b.report('upcase constant') do
5_000_000.times { 'OK' == OK }
end
b.report('camel case constant') do
5_000_000.times { 'OK' == Ok }
end
end
__END__
                                    user     system      total        real
upcase constant                 2.020000   0.010000   2.030000 (  2.039640)
camel case constant             2.040000   0.010000   2.050000 (  2.057488)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment