mirror of mongrel-development@rubyforge.org (inactive)
 help / color / mirror / Atom feed
From: Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org>
To: mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
Subject: Re: [PATCH] http11: ~6% performance increase in header parsing
Date: Sat, 8 Mar 2008 00:12:10 -0800	[thread overview]
Message-ID: <20080308081210.GA30702@hand.yhbt.net> (raw)
In-Reply-To: <3ae7f4480803060153v18e955a5j9038f93e558f81d1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

ry dahl <ry-Xek56AhD01PHviPkdFu9cA@public.gmane.org> wrote:
> Hi Eric,
> >  I'm getting an even bigger (~22%) performance
> > improvement by predefining
> >  some common HTTP headers as global frozen
> > strings upfront (r992)
> Why don't you do this in Ragel? It will be faster and you don't need
> to depend on bsearch. I pull out content-length header in ragel in
> ebb:
>  http://github.com/ry/ebb/tree/master/src/parser.rl
> (although there is a bug with this because (content_length |
> message_header ) needs some priorities set so message_header isn't
> matching content-length too. should be
>    (content_length >2 | message_header >1 )
> or something).

Then I'd have to define a new C function for every header I wanted to
optimize for, and then also point to that function inside the Ragel file
for each header.

Unless we use something like ERB to generate this code for both Ragel
and C, I'm not sure it's worth the effort to go through with all the
extra code.

Currently, with my C/CPP code, I can add or remove headers to memoize
strings for by adding or removing one line per header in the C file.
Pretty much as easy as it gets maintenance-wise.

> Also - the state machine should be upgraded to compile with ragel 6.
> this basically involves removing %write eof;

Yes.  At the same time, I'm not sure if I should force every other
developer to upgrade... Evan?  Zed?

Eric Wong

       reply	other threads:[~2008-03-08  8:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080229015309.GA9080@untitled>
     [not found] ` <20080303044659.5a550c19.zedshaw@zedshaw.com>
     [not found]   ` <20080302123712.GA13979@hand.yhbt.net>
     [not found]     ` <20080306075421.GA1583@hand.yhbt.net>
     [not found]       ` <3ae7f4480803060153v18e955a5j9038f93e558f81d1@mail.gmail.com>
     [not found]         ` <3ae7f4480803060153v18e955a5j9038f93e558f81d1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-03-08  8:12           ` Eric Wong [this message]
     [not found]             ` <20080308081210.GA30702-r0bfCMRs158eIZ0/mPfg9Q@public.gmane.org>
2008-03-08  8:14               ` [PATCH] http11: ~6% performance increase in header parsing Evan Weaver
     [not found]                 ` <b6f68fc60803080014x3241d9b0n6430c5ec93f7ea2d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-03-08 22:02                   ` Eric Wong
2008-03-24 18:39                     ` Evan Weaver
     [not found]                       ` <b6f68fc60803241139g70b2d8a3v5d01e7472367fb74-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-03-25  3:43                         ` Eric Wong
2008-03-25  4:53                           ` Evan Weaver
     [not found]                             ` <b6f68fc60803242153i65dbb67re6bc9457060ee03f-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-03-25  8:13                               ` ry dahl
2008-03-08 12:37               ` Luis Lavena
2008-03-08 17:37               ` ry dahl
replies disabled, historical list

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).