From 586aa14caa4106ac1085bad64d33baf7065ec3bf Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Thu, 26 Oct 2023 14:30:14 +1300 Subject: [PATCH 1/3] Lower case normalization benchmark. --- examples/header-lowercase/benchmark.rb | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 examples/header-lowercase/benchmark.rb 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 From f9c447e3a3272e98d1e436cd2881b408240dded1 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Mon, 22 Jan 2024 18:05:39 +1300 Subject: [PATCH 2/3] Require shared endpoint by default. (#148) --- lib/async/http/endpoint.rb | 1 + 1 file changed, 1 insertion(+) 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' From ae4976ecb0aeb30f5b2f7dab788ddc3e1f3a328b Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Mon, 22 Jan 2024 18:15:10 +1300 Subject: [PATCH 3/3] Bump minor version. --- lib/async/http/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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