blob: c4db5efa0b559082a88489aa114df5a46f917c67 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
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 |
# +------+----------+
#
|