Date | Commit message (Collapse) |
|
Avoid conflicting with existing (and future) Mongrel installs in
case either changes. Of course, this also allows us more
freedom to experiment and break the API if needed...
However, I'm only planning on making minor changes to
remove the amount of C code we have to maintain and
possibly some minor performance improvements.
|
|
Most HTTP traffic will send a small, common subset of headers.
For these, we can avoid recreating RString objects and instead
use predefined, frozen RString objects.
This results in a ~22% speed improvement in header parsing for
common cases where clients send the headers we have predefined,
frozen objects for.
Additionally, new parser tests have been added to ensure
the optimizations work (for MRI).
There is an optional qsort(3) and bsearch(3) dependency to
improve average lookup time for the frozen strings; but it's not
enabled due to portability concerns. The linear search
performance is acceptable, and can be hand-optimized for the
most frequently seen headers by putting those first.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@992 19e92222-5c0b-0410-8929-a290d50e31e9
|
|
This is based on Zed's suggestion and helps take complexity out
of the hand-written C code, allowing memcpy() to be used instead.
Zed Shaw wrote in <20080303044659.5a550c19.zedshaw@zedshaw.com>:
> * Also, now that I think about it, if you don't care that the original
> string is modified in place then you can just have ragel do all of this
> as it goes. Simply modify the parser to have it do this transform on
> the header chars using the existing pointer. That'd probably be
> alright since people don't usually keep the input headers around when
> using the mongrel parser.
I don't have a working Java runtime, so I've only made the bare
minimum modification to the http11_parser.java.rl file which
allows Ragel to still work with it. All the other Java parts
are untouched and whatever upper-casing routine was used before
continues to be used now.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@990 19e92222-5c0b-0410-8929-a290d50e31e9
|
|
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
|
|
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@4 19e92222-5c0b-0410-8929-a290d50e31e9
|