mirror of
https://github.com/clearlinux/dockerfiles.git
synced 2026-06-29 09:05:52 +00:00
15 lines
362 B
Ruby
15 lines
362 B
Ruby
require 'benchmark'
|
|
|
|
string_AZ = Hash[("a".."z").to_a.zip((1..26).to_a)]
|
|
symbol_AZ = Hash[(:a..:z).to_a.zip((1..26).to_a)]
|
|
|
|
string_time = Benchmark.realtime do
|
|
100_000.times { string_AZ["r"] }
|
|
end
|
|
|
|
symbol_time = Benchmark.realtime do
|
|
100_000.times { symbol_AZ[:r] }
|
|
end
|
|
|
|
puts "String time: #{string_time} seconds."
|
|
puts "Symbol time: #{symbol_time} seconds." |