diff --git a/examples/header-lowercase/benchmark.rb b/examples/header-lowercase/benchmark.rb new file mode 100644 index 00000000..58d92fb7 --- /dev/null +++ b/examples/header-lowercase/benchmark.rb @@ -0,0 +1,43 @@ +require 'benchmark/ips' + +class NormalizedHeaders + def initialize(fields) + @fields = fields + end + + def [](key) + @fields[key.downcase] + end +end + +class Headers + def initialize(fields) + @fields = fields + end + + def [](key) + @fields[key] + end +end + +FIELDS = { + 'content-type' => 'text/html', + 'content-length' => '127889', + 'accept-ranges' => 'bytes', + 'date' => 'Tue, 14 Jul 2015 22:00:02 GMT', + 'via' => '1.1 varnish', + 'age' => '0', + 'connection' => 'keep-alive', + 'x-served-by' => 'cache-iad2125-IAD', +} + +NORMALIZED_HEADERS = NormalizedHeaders.new(FIELDS) +HEADERS = Headers.new(FIELDS) + +Benchmark.ips do |x| + x.report('NormalizedHeaders[Content-Type]') { NORMALIZED_HEADERS['Content-Type'] } + x.report('NormalizedHeaders[content-type]') { NORMALIZED_HEADERS['content-type'] } + x.report('Headers') { HEADERS['content-type'] } + + x.compare! +end diff --git a/lib/async/http/endpoint.rb b/lib/async/http/endpoint.rb index cc482f85..ce808396 100644 --- a/lib/async/http/endpoint.rb +++ b/lib/async/http/endpoint.rb @@ -7,6 +7,7 @@ require 'async/io/host_endpoint' require 'async/io/ssl_endpoint' require 'async/io/ssl_socket' +require 'async/io/shared_endpoint' require_relative 'protocol/http1' require_relative 'protocol/https' diff --git a/lib/async/http/version.rb b/lib/async/http/version.rb index cfbd05da..be1dea53 100644 --- a/lib/async/http/version.rb +++ b/lib/async/http/version.rb @@ -5,6 +5,6 @@ module Async module HTTP - VERSION = "0.61.0" + VERSION = "0.62.0" end end