Sha256: c98018ab24bfe4f4dd474ff5ea928ae194fe09a92e7f18210e40afcbbddfbccd
Contents?: true
Size: 927 Bytes
Versions: 8
Compression:
Stored size: 927 Bytes
Contents
require 'benchmark' require 'tempfile' require 'unicorn' nr = ENV['nr'] ? ENV['nr'].to_i : 100 bs = ENV['bs'] ? ENV['bs'].to_i : (1024 * 1024) count = ENV['count'] ? ENV['count'].to_i : 4 length = bs * count slice = (' ' * bs).freeze big = Tempfile.new('') def big.unicorn_peeraddr # old versions of Unicorn used this '127.0.0.1' end big.syswrite( "PUT /hello/world/puturl?abcd=efg&hi#anchor HTTP/1.0\r\n" \ "Host: localhost\r\n" \ "Accept: */*\r\n" \ "Content-Length: #{length}\r\n" \ "User-Agent: test-user-agent 0.1.0 (Mozilla compatible) 5.0 asdfadfasda\r\n" \ "\r\n") count.times { big.syswrite(slice) } big.sysseek(0) big.fsync include Unicorn request = HttpRequest.new(Logger.new($stderr)) unless request.respond_to?(:reset) def request.reset # no-op end end Benchmark.bmbm do |x| x.report("big") do for i in 1..nr request.read(big) request.reset big.sysseek(0) end end end
Version data entries
8 entries across 8 versions & 1 rubygems