Last active
August 29, 2015 14:16
-
-
Save byroot/18ee6ce0e50fd12f5f76 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
require 'benchmark/ips' | |
require 'active_support/cache' | |
require 'memcached' | |
require 'active_support/cache/memcached_store' | |
require 'active_support/cache/dalli_store' | |
$dalli = ActiveSupport::Cache::DalliStore.new('127.0.0.1:11211') | |
$memcached = ActiveSupport::Cache::MemcachedStore.new('127.0.0.1:11211') | |
KEY = 'somekey' | |
SMALL_VALUE = 'a' * 30 | |
BIG_VALUE = 'a' * 100_000 | |
$dalli.write(KEY, BIG_VALUE) | |
$memcached.write(KEY, BIG_VALUE) | |
Benchmark.ips do |x| | |
x.report('dalli:read') { $dalli.read(KEY) } | |
x.report('memcached:read') { $memcached.read(KEY) } | |
x.report('dalli:write') { $dalli.write(KEY, SMALL_VALUE) } | |
x.report('memcached:write') { $memcached.write(KEY, SMALL_VALUE) } | |
x.report('dalli:write-big') { $dalli.write(KEY, BIG_VALUE) } | |
x.report('memcached:write-big') { $memcached.write(KEY, BIG_VALUE) } | |
end |
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 ------------------------------------- | |
dalli:read 581.000 i/100ms | |
memcached:read 583.000 i/100ms | |
dalli:write 1.126k i/100ms | |
memcached:write 1.187k i/100ms | |
dalli:write-big 367.000 i/100ms | |
memcached:write-big 486.000 i/100ms | |
------------------------------------------------- | |
dalli:read 6.232k (± 4.9%) i/s - 31.374k | |
memcached:read 6.120k (± 4.0%) i/s - 30.899k | |
dalli:write 11.337k (±14.0%) i/s - 55.174k | |
memcached:write 12.656k (± 8.8%) i/s - 62.911k | |
dalli:write-big 3.792k (± 2.3%) i/s - 19.084k | |
memcached:write-big 4.668k (± 9.2%) i/s - 23.328k |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment