Skip to content

Instantly share code, notes, and snippets.

@dwfait
Last active January 15, 2016 17:58
Show Gist options
  • Save dwfait/4f4c4517dc0d0701e164 to your computer and use it in GitHub Desktop.
Save dwfait/4f4c4517dc0d0701e164 to your computer and use it in GitHub Desktop.
Calculating -------------------------------------
== 11.195k i/100ms
eql? 14.323k i/100ms
-------------------------------------------------
== 119.132k (± 4.5%) i/s - 604.530k
eql? 158.007k (± 3.0%) i/s - 802.088k
Comparison:
eql?: 158006.6 i/s
==: 119131.6 i/s - 1.33x slower
require 'benchmark/ips'
Benchmark.ips do |x|
a1 = (1..10000).to_a
a2 = (1..10000).to_a
x.report("==") do
a1 == a2
end
x.report("eql?") do
a1.eql? a2
end
x.compare!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment