Skip to content

Instantly share code, notes, and snippets.

@shiroginne
Created June 25, 2012 09:45
Show Gist options
  • Save shiroginne/2987675 to your computer and use it in GitHub Desktop.
Save shiroginne/2987675 to your computer and use it in GitHub Desktop.
ruby speed
~> ~ time ruby -e "10000.times { %w(one two).include?('two')}"
ruby -e "10000.times { %w(one two).include?('two')" 0.02s user 0.01s system 30% cpu 0.091 total
ruby -e "10000.times { %w(one two).include?('two')}" 0.03s user 0.01s system 74% cpu 0.046 total
ruby -e "10000.times { %w(one two).include?('two')}" 0.03s user 0.01s system 42% cpu 0.084 total
ruby -e "10000.times { %w(one two).include?('two')}" 0.03s user 0.01s system 24% cpu 0.153 total
ruby -e "10000.times { %w(one two).include?('two')}" 0.03s user 0.01s system 85% cpu 0.040 total
ruby -e "10000.times { %w(one two).include?('two')}" 0.03s user 0.01s system 31% cpu 0.117 total
ruby -e "10000.times { %w(one two).include?('two')}" 0.03s user 0.01s system 38% cpu 0.093 total
ruby -e "10000.times { %w(one two).include?('two')}" 0.03s user 0.01s system 30% cpu 0.115 total
~> ~ time ruby -e "10000.times { ['one', 'two'].include?('two')}"
ruby -e "10000.times { %w(one two).include?('two')}" 0.03s user 0.01s system 44% cpu 0.080 total
ruby -e "10000.times { ['one', 'two'].include?('two')}" 0.03s user 0.01s system 46% cpu 0.077 total
ruby -e "10000.times { ['one', 'two'].include?('two')}" 0.03s user 0.01s system 82% cpu 0.042 total
ruby -e "10000.times { ['one', 'two'].include?('two')}" 0.03s user 0.01s system 86% cpu 0.040 total
ruby -e "10000.times { ['one', 'two'].include?('two')}" 0.03s user 0.01s system 31% cpu 0.116 total
ruby -e "10000.times { ['one', 'two'].include?('two')}" 0.03s user 0.01s system 23% cpu 0.151 total
ruby -e "10000.times { ['one', 'two'].include?('two')}" 0.03s user 0.01s system 38% cpu 0.100 total
ruby -e "10000.times { ['one', 'two'].include?('two')}" 0.03s user 0.01s system 35% cpu 0.110 total
ruby -e "10000.times { ['one', 'two'].include?('two')}" 0.03s user 0.01s system 31% cpu 0.117 total
ruby -e "10000.times { ['one', 'two'].include?('two')}" 0.03s user 0.01s system 44% cpu 0.085 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment