summaryrefslogtreecommitdiff
path: root/jni/ruby/benchmark/bm_hash_aref_sym.rb
blob: f75d163fe6713d0849f01059916ec8ae754412c0 (plain)
1
2
3
4
5
6
7
8
9
h = {}
syms = ('a'..'z').to_a
begin
  syms = eval("%i[#{syms.join(' ')}]")
rescue SyntaxError # <= 1.9.3
  syms.map!(&:to_sym)
end
syms.each { |s| h[s] = s }
200_000.times { syms.each { |s| h[s] } }