aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2016-01-28 16:08:03 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2016-01-28 16:08:15 -0800
commitc082a7aae4a41b52e58c7dea43e7e9c6c41d11ad (patch)
treed763ac67ee2b5e1bfc8c97dff31b92bf5aa66331 /tools
parentee9d479941061acdec6b3a6a3805408624f8cc22 (diff)
downloadrails-c082a7aae4a41b52e58c7dea43e7e9c6c41d11ad.tar.gz
rails-c082a7aae4a41b52e58c7dea43e7e9c6c41d11ad.tar.bz2
rails-c082a7aae4a41b52e58c7dea43e7e9c6c41d11ad.zip
speed up accept header parsing a bit.
Accept header is taken from what Safari on El Capitan sends: ```ruby require 'benchmark/ips' require 'action_dispatch/http/mime_type' require 'active_support/all' accept = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' Benchmark.ips do |x| x.report "omg" do Mime::Type.parse(accept) end end ``` Before: ``` [aaron@TC actionpack (master)]$ be ruby ../x.rb Calculating ------------------------------------- omg 3.181k i/100ms ------------------------------------------------- omg 35.062k (±12.8%) i/s - 174.955k [aaron@TC actionpack (master)]$ be ruby ../x.rb Calculating ------------------------------------- omg 3.153k i/100ms ------------------------------------------------- omg 33.724k (±12.4%) i/s - 167.109k [aaron@TC actionpack (master)]$ be ruby ../x.rb Calculating ------------------------------------- omg 3.575k i/100ms ------------------------------------------------- omg 37.251k (±10.4%) i/s - 185.900k ``` After: ``` [aaron@TC actionpack (master)]$ be ruby ../x.rb Calculating ------------------------------------- omg 3.365k i/100ms ------------------------------------------------- omg 40.069k (±16.1%) i/s - 198.535k [aaron@TC actionpack (master)]$ be ruby ../x.rb Calculating ------------------------------------- omg 4.168k i/100ms ------------------------------------------------- omg 47.596k (± 7.7%) i/s - 237.576k [aaron@TC actionpack (master)]$ be ruby ../x.rb Calculating ------------------------------------- omg 4.282k i/100ms ------------------------------------------------- omg 43.626k (±17.7%) i/s - 209.818k ```
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions