ruby/benchmark/bm_hash_aref_sym.rb

5 строки
112 B
Ruby

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