users (with 1M lookup) | With Array (sec) | With Set (sec) |
---|---|---|
100 | 5.411557 | 3.558224 |
1000 | 39.546319 | 3.583432 |
-
-
Save luislee818/298698122c2f426d34bb to your computer and use it in GitHub Desktop.
set_over_array for rollout gem
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' | |
describe "Rollout::Feature" do | |
describe "performance" do | |
before do | |
@feature = Rollout::Feature.new(:chat) | |
end | |
it "outputs result" do | |
puts Benchmark.measure { | |
# 1000 enabled users | |
(1..1000).each do |num| | |
@feature.add_user num | |
end | |
# 1000000 lookups | |
(1..1000000).each do |num| | |
@feature.active?(:chat, num) | |
end | |
} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment