memcached も試してみた
前回に引き続き memcached で試してみました. 結果は期待通りです.
$ ruby m.rb 100 user system total real 0.030000 0.010000 0.040000 ( 0.050384) $ ruby m.rb 1000 user system total real 0.290000 0.070000 0.360000 ( 0.421055) $ ruby m.rb 10000 user system total real 3.830000 0.480000 4.310000 ( 4.862486)
m.rb -- memcached クライアント
require "rubygems" require "memcache" require "benchmark" cache = MemCache.new "localhost:11211" puts Benchmark::CAPTION puts Benchmark::measure { ARGV[0].to_i.times {|i| cache[i.to_s] = "hello world #{i}" } }
追記(2009/6/11 0:04)
system_timer を gem install すると以下のようにさらに速くなりました.
$ ruby m.rb 10000 user system total real 1.700000 0.480000 2.180000 ( 2.577873)