Sha256: d0fdde2c8deaf50ef34fe668b3f200319371ec19aea07b2c7693ab86142af391
Contents?: true
Size: 710 Bytes
Versions: 2
Compression:
Stored size: 710 Bytes
Contents
require 'rubygems' require 'eventmachine' require 'eventmachine/client' require 'benchmark' class StopClient < EchoClient def receive_data(data) @response = data EventMachine.stop_event_loop end end client = nil n = (ARGV.shift || 1000).to_i Benchmark.bm(25) do |bm| bm.report("EM (stop_event_loop):") do n.times do EventMachine.run do client = EventMachine.connect "0.0.0.0", 8080, StopClient client.send_data('PUT foo bar') end end end bm.report("EM (close_connection):") do n.times do EventMachine.run do client = EventMachine.connect "0.0.0.0", 8080, EchoClient client.send_data('PUT foo bar') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
oria-0.1.1 | benchmarks/em_stop_v_disconnect.rb |
oria-0.1.0 | benchmarks/em_stop_v_disconnect.rb |