Sha256: cc4415376582ed93f32b68c59324bdeb4728cca36db260a741c72246c1bbd627
Contents?: true
Size: 905 Bytes
Versions: 2
Compression:
Stored size: 905 Bytes
Contents
require 'rubygems' require 'redis' require 'eventmachine' require 'eventmachine/client' require 'benchmark' redis = Redis.new client = nil n = (ARGV.shift || 1000).to_i Benchmark.bm(15) do |bm| bm.report("Redis (write):") do n.times do redis['foo'] = 'bar' end end bm.report("Echo (write):") do n.times do EventMachine.run do # TODO: Figure out how EM handles connecting TO UDP servers client = EventMachine.open_datagram_socket "0.0.0.0", 0, EchoClient client.send_datagram('GET foo', "0.0.0.0", 8080) end end end bm.report("Redis (read):") do n.times do foo = redis['foo'] end end bm.report("Echo (read):") do n.times do EventMachine.run do client = EventMachine.open_datagram_socket "0.0.0.0", 0, EchoClient client.send_datagram('GET foo', "0.0.0.0", 8080) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
oria-0.1.1 | benchmarks/udp_v_redis.rb |
oria-0.1.0 | benchmarks/udp_v_redis.rb |