Skip to content

Instantly share code, notes, and snippets.

@gigq
Created August 13, 2009 21:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save gigq/167477 to your computer and use it in GitHub Desktop.
tokyobench.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'tokyotyrant'
require 'uuidtools'
require 'benchmark'
results = File.new("/tmp/tokyoload.csv", "w")
rdb = TokyoTyrant::RDB::new
rdb.open("localhost", 1978)
rdb.vanish
(1..10000).each do |batch|
results.puts batch.to_s+"\t"+Benchmark.realtime {
(1..1000).each do |row|
rdb.put(UUIDTools::UUID.random_create.to_i.to_s(36), Marshal.dump({"batch" => batch, "row" => row }))
end
}.to_s
results.flush
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment