ruby/benchmark/bm_hash_shift.rb

11 строки
92 B
Ruby

h = {}
10000.times do |i|
h[i] = nil
end
50000.times do
k, v = h.shift
h[k] = v
end