ruby/benchmark/hash_aref_str.rb

5 строки
113 B
Ruby

h = {}
strs = ('a'..'z').to_a.map!(&:freeze)
strs.each { |s| h[s] = s }
200_000.times { strs.each { |s| h[s] } }