Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 65 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. ids = (1..1_000_000).to_a; nil
  2. x = rand(1_000_000)
  3.  
  4. Benchmark.realtime do
  5.   the_set = ids.to_set
  6.   1000.times do
  7.     the_set.include?(x)
  8.   end
  9. end
  10. # => 0.7543990612030029
  11.  
  12. Benchmark.realtime do
  13.   1000.times do
  14.     ids.include?(x)
  15.   end
  16. end
  17. # => 44.60349249839783
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top