Last active
January 15, 2016 17:58
-
-
Save dwfait/4f4c4517dc0d0701e164 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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