Skip to content

Commit

Permalink
Merge 59e8978 into a68c1e6
Browse files Browse the repository at this point in the history
  • Loading branch information
davidor committed Mar 4, 2019
2 parents a68c1e6 + 59e8978 commit a1f1eaa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions async-redis.gemspec
Expand Up @@ -22,6 +22,7 @@ Gem::Specification.new do |spec|

spec.add_development_dependency "async-rspec", "~> 1.1"
spec.add_development_dependency "redis"
spec.add_development_dependency "hiredis"
spec.add_development_dependency "benchmark-ips"

spec.add_development_dependency "covered"
Expand Down
11 changes: 11 additions & 0 deletions spec/async/redis/performance_spec.rb
Expand Up @@ -31,6 +31,7 @@
let(:endpoint) {Async::Redis.local_endpoint}
let(:async_client) {Async::Redis::Client.new(endpoint)}
let(:redis_client) {Redis.new}
let(:redis_client_hiredis) {Redis.new(driver: :hiredis)}

it "should be fast to set keys" do
Benchmark.ips do |benchmark|
Expand Down Expand Up @@ -65,6 +66,16 @@
expect(redis_client.get(key)).to be == value
end
end

benchmark.report("redis-rb (hiredis)") do |times|
key = keys.sample
value = times.to_s

i = 0; while i < times; i += 1
redis_client_hiredis.set(key, value)
expect(redis_client_hiredis.get(key)).to be == value
end
end

benchmark.compare!
end
Expand Down

0 comments on commit a1f1eaa

Please sign in to comment.