Skip to content

Instantly share code, notes, and snippets.

@briankung
Created April 12, 2018 23:56
Show Gist options
  • Save briankung/dc66c68f4395b70220571eb0f46c1ac7 to your computer and use it in GitHub Desktop.
Save briankung/dc66c68f4395b70220571eb0f46c1ac7 to your computer and use it in GitHub Desktop.
require 'benchmark'
Benchmark.bm do |x|
arr = Array.new(1_000_000) { rand(1...9) }
x.report { 500.times { arr.uniq } }
x.report { 500.times { arr & arr } }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment