Skip to content

Instantly share code, notes, and snippets.

@katsyoshi
Created June 17, 2012 22:15
Show Gist options
  • Select an option

  • Save katsyoshi/2945880 to your computer and use it in GitHub Desktop.

Select an option

Save katsyoshi/2945880 to your computer and use it in GitHub Desktop.
Hashの比較
nums = ARGV.shift.to_i
moto = {}
hikaku = {}
hajime = Time.now
nums.times do |t|
n = t.to_s(36)
moto[n] = t
hikaku[n] = t
end
start = Time.now
puts moto == hikaku
owari = Time.now
puts moto.size
puts hikaku.size
puts "hikaku:"+(owari - start).to_s+"s"
puts "hikaku+seisei:"+(owari - hajime).to_s+"s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment