Sha256: 6089731011b18ab09527c7734734bb24def220fd826758ef2e9de4ead96a6bf8

Contents?: true

Size: 503 Bytes

Versions: 156

Compression:

Stored size: 503 Bytes

Contents

require 'rubygems'
require 'tach'

data = {"some" => "var", "goes" => "in", :here => 0}
Tach.meter(1_000_000) do
  tach('for') do
    for key, values in data
      key == values
    end
  end
  tach('each') do
    data.each do |key, values|
      key == values
    end
  end
end

# ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
# 
# +------+----------+
# | tach | total    |
# +------+----------+
# | each | 2.748909 |
# +------+----------+
# | for  | 2.949512 |
# +------+----------+
#

Version data entries

156 entries across 154 versions & 6 rubygems

Version Path
able-neo4j-1.0.0 vendor/bundle/jruby/1.9/gems/excon-0.45.4/benchmarks/for_vs_hash_each.rb
excon-0.49.0 benchmarks/for_vs_hash_each.rb
excon-0.48.0 benchmarks/for_vs_hash_each.rb
excon-0.47.0 benchmarks/for_vs_hash_each.rb
excon-0.46.0 benchmarks/for_vs_hash_each.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/excon-0.45.4/benchmarks/for_vs_hash_each.rb
excon-0.45.4 benchmarks/for_vs_hash_each.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/excon-0.45.3/benchmarks/for_vs_hash_each.rb
excon-0.45.3 benchmarks/for_vs_hash_each.rb
excon-0.45.2 benchmarks/for_vs_hash_each.rb
excon-0.45.1 benchmarks/for_vs_hash_each.rb
excon-0.45.0 benchmarks/for_vs_hash_each.rb
excon-0.44.4 benchmarks/for_vs_hash_each.rb
excon-0.44.3 benchmarks/for_vs_hash_each.rb
excon-0.44.2 benchmarks/for_vs_hash_each.rb
excon-0.44.1 benchmarks/for_vs_hash_each.rb
excon-0.44.0 benchmarks/for_vs_hash_each.rb
excon-0.43.0 benchmarks/for_vs_hash_each.rb
excon-0.42.1 benchmarks/for_vs_hash_each.rb
excon-0.42.0 benchmarks/for_vs_hash_each.rb