yes I removed those conditions and looks like Ry did the same (by  
looking quickly at his code).

On 21-Jan-08, at 4:12 PM, Luis Lavena wrote:

> On Jan 21, 2008 7:00 PM, Kevin Williams <[EMAIL PROTECTED]> wrote:
>> On Jan 21, 2008 1:55 PM, Luis Lavena <[EMAIL PROTECTED]> wrote:
>>> Hey ry, did you tweaked the HttpParser like Thin guy did?
>>>
>>> I was thinking about the modifications he did:
>>>
>>> He removed all the if conditions evaluating http_field,
>>> request_method, request_uri and others (most the ones that are
>>> allocated/initialized in HttpParser_alloc).
>>
>> I don't think those conditions were *removed*, I think they were
>> *moved*, but I've only glanced at the C code and would barely know
>> what I was looking at anyway. :)
>
> No, he removed them:
>
> http://pastie.caboo.se/141633
>
> The ragel code will generate the http11_parser.c file, and http11.c
> file defines all the functions pointers:
>
> http11.c:207..225:
>
> VALUE HttpParser_alloc(VALUE klass)
> {
>  VALUE obj;
>  http_parser *hp = ALLOC_N(http_parser, 1);
>  TRACE();
>  hp->http_field = http_field;
>  hp->request_method = request_method;
>  hp->request_uri = request_uri;
>  hp->fragment = fragment;
>  hp->request_path = request_path;
>  hp->query_string = query_string;
>  hp->http_version = http_version;
>  hp->header_done = header_done;
>  http_parser_init(hp);
>
>  obj = Data_Wrap_Struct(klass, NULL, HttpParser_free, hp);
>
>  return obj;
> }
>
> Theory indicates that allocation happens way before the ragel code is
> getting executed, so there is no need to evaluate the conditions all
> the time, ending with a speed boost.
>
> -- 
> Luis Lavena
> Multimedia systems
> -
> A common mistake that people make when trying to design
> something completely foolproof is to underestimate
> the ingenuity of complete fools.
> Douglas Adams
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users

_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to