about summary refs log tree commit homepage
path: root/ext/http11/http11_parser.rl
diff options
context:
space:
mode:
authornormalperson <normalperson@19e92222-5c0b-0410-8929-a290d50e31e9>2008-03-02 02:34:57 +0000
committernormalperson <normalperson@19e92222-5c0b-0410-8929-a290d50e31e9>2008-03-02 02:34:57 +0000
commit6b981f388abd352f57c984818a26182af56b1f6d (patch)
tree8b6a0ac3e54e92d3969a66bd9956049ce4154407 /ext/http11/http11_parser.rl
parentcf4c3f142c4403f3eb1bad4baedf58ec9247d1e5 (diff)
downloadunicorn-6b981f388abd352f57c984818a26182af56b1f6d.tar.gz
Allocate one string object and avoid appending to it causing it
to be resized.  Additionally, optimize the string toupper copy
so that it's done in a single pass.

Also, use an inline, locale-independent toupper() implementation
which should be more predictable for users with exotic locales
(HTTP header names are always ASCII).

The following test script was used:
require 'mongrel'
include Mongrel

parser = HttpParser.new
req = "GET /ruby HTTP/1.1\r\n" \
      "User-Agent: curl/7.12.3\r\n" \
      "Host: bogomips.org\r\n" \
      "Accept: */*\r\n" \
      "\r\n".freeze
hash = Hash.new
100000.times do
  parser.execute(hash, req, 0)
  parser.reset
  hash.clear
end


git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@989 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'ext/http11/http11_parser.rl')
0 files changed, 0 insertions, 0 deletions