Permalink
Browse files

Added some benchmarks for LocalCache

  • Loading branch information...
1 parent 4399ffd commit 89151230fbc1bb3a603f354218052be9bc60f81c @chendo chendo committed Dec 13, 2012
Showing with 35 additions and 1 deletion.
  1. +35 −1 test/benchmark_test.rb
View
@@ -24,7 +24,7 @@
should 'run benchmarks' do
memcached do
- Benchmark.bm(31) do |x|
+ Benchmark.bm(32) do |x|
n = 2500
@@ -44,6 +44,40 @@
end
end
+ x.report("mixed:rails-localcache:dalli") do
+ n.times do
+ @ds.with_local_cache do
+ @ds.read @key1
+ @ds.write @key2, @value
+ @ds.fetch(@key3) { @value }
+ @ds.fetch(@key2) { @value }
+ @ds.fetch(@key1) { @value }
+ @ds.write @key2, @value, :unless_exists => true
+ @ds.delete @key2
+ @ds.increment @counter, 1, :initial => 100
+ @ds.increment @counter, 1, :expires_in => 12
+ @ds.decrement @counter, 1
+ end
+ end
+ end
+
+ x.report("read_multi:rails-localstore:dalli") do
+ n.times do
+ @ds.with_local_cache do
+ @ds.read_multi @key1, @key2, @key3
+ @ds.read @key1
+ @ds.read @key2
+ @ds.read @key3
+ end
+ @ds.with_local_cache do
+ @ds.read @key1
+ @ds.read @key2
+ @ds.read @key3
+ @ds.read_multi @key1, @key2, @key3
+ end
+ end
+ end
+
@m = Dalli::Client.new(@servers)
x.report("set:plain:dalli") do
n.times do

0 comments on commit 8915123

Please sign in to comment.