Sha256: 9cb493dbc4899fa1a1e85abff707add0f510ea57f011897ee738f30f7e7e3417
Contents?: true
Size: 630 Bytes
Versions: 8
Compression:
Stored size: 630 Bytes
Contents
require 'benchmark' require 'unicorn' class NullWriter def syswrite(buf); buf.size; end alias write syswrite def close; end end include Unicorn socket = NullWriter.new bs = ENV['bs'] ? ENV['bs'].to_i : 4096 count = ENV['count'] ? ENV['count'].to_i : 1 slice = (' ' * bs).freeze body = (1..count).map { slice }.freeze hdr = { 'Content-Length' => (bs * count).to_s.freeze, 'Content-Type' => 'text/plain'.freeze }.freeze response = [ 200, hdr, body ].freeze nr = ENV['nr'] ? ENV['nr'].to_i : 100000 Benchmark.bmbm do |x| x.report do for i in 1..nr HttpResponse.write(socket.dup, response) end end end
Version data entries
8 entries across 8 versions & 1 rubygems