Skip to content

Instantly share code, notes, and snippets.

@dwfait
Last active January 15, 2016 17:31
Show Gist options
  • Save dwfait/c1f211c0d9201d087cc3 to your computer and use it in GitHub Desktop.
Save dwfait/c1f211c0d9201d087cc3 to your computer and use it in GitHub Desktop.
Calculating -------------------------------------
old 317.000 i/100ms
new 14.732k i/100ms
-------------------------------------------------
old 3.189k (± 3.4%) i/s - 16.167k
new 158.659k (± 3.1%) i/s - 795.528k
Comparison:
new: 158658.9 i/s
old: 3189.4 i/s - 49.75x slower
require 'benchmark/ips'
Benchmark.ips do |x|
a1 = (1..10000).to_a
a2 = (1..10000).to_a
x.report("old") do
a1.eql? a2
end
x.report("new") do
a1.new_eql? a2
end
x.compare!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment