Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ids = (1..1_000_000).to_a; nil
- x = rand(1_000_000)
- Benchmark.realtime do
- the_set = ids.to_set
- 1000.times do
- the_set.include?(x)
- end
- end
- # => 0.7543990612030029
- Benchmark.realtime do
- 1000.times do
- ids.include?(x)
- end
- end
- # => 44.60349249839783
Add Comment
Please, Sign In to add comment