From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Evan Weaver" Newsgroups: gmane.comp.lang.ruby.mongrel.devel Subject: Re: [PATCH] http11: ~6% performance increase in header parsing Date: Mon, 24 Mar 2008 14:39:05 -0400 Message-ID: References: <20080229015309.GA9080@untitled> <20080303044659.5a550c19.zedshaw@zedshaw.com> <20080302123712.GA13979@hand.yhbt.net> <20080306075421.GA1583@hand.yhbt.net> <3ae7f4480803060153v18e955a5j9038f93e558f81d1@mail.gmail.com> <20080308081210.GA30702@hand.yhbt.net> <20080308220220.GA27749@mayonaise> Reply-To: mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1206384006 6484 80.91.229.12 (24 Mar 2008 18:40:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Mar 2008 18:40:06 +0000 (UTC) To: mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Original-X-From: mongrel-development-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Mon Mar 24 19:40:32 2008 Return-path: Envelope-to: gclrmd-mongrel-development@m.gmane.org In-Reply-To: <20080308220220.GA27749@mayonaise> Content-Disposition: inline X-Google-Sender-Auth: fe005298e68263fe X-BeenThere: mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: mongrel-development-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: mongrel-development-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.ruby.mongrel.devel:6 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.50) id 1Jdraw-0001qd-Sb for gclrmd-mongrel-development@m.gmane.org; Mon, 24 Mar 2008 19:40:31 +0100 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 7360518585D4; Mon, 24 Mar 2008 14:39:33 -0400 (EDT) Received: from gv-out-0910.google.com (gv-out-0910.google.com [216.239.58.185]) by rubyforge.org (Postfix) with ESMTP id 746031858697 for ; Mon, 24 Mar 2008 14:39:11 -0400 (EDT) Received: by gv-out-0910.google.com with SMTP id l14so469611gvf.12 for ; Mon, 24 Mar 2008 11:39:10 -0700 (PDT) Received: by 10.114.14.1 with SMTP id 1mr12411843wan.9.1206383948874; Mon, 24 Mar 2008 11:39:08 -0700 (PDT) Received: by 10.114.205.10 with HTTP; Mon, 24 Mar 2008 11:39:05 -0700 (PDT) List-Post: Hi all, I backported the trunk parser changes and applied the Ragel fix to branches/stable_1-2 . Two tests are currently failing... could someone (Eric, Ry?) take a look at these? I am not good enough with Ragel to be able to say whether or not the eof change is related to the test failures. Thanks, Evan On Sat, Mar 8, 2008 at 6:02 PM, Eric Wong wrote: > Evan Weaver wrote: > > > Upgrading ragel is fine with me. > > Here's my work-in-progress. The changes below are pretty much copied > from ry's changes in ebb. > > I haven't been able to figure out why > test_horrible_queries(HttpParserTest) is failing, so any help here would > be appreciated. > > Thanks. > > diff --git a/Rakefile b/Rakefile > index f47d7a2..07a89c2 100644 > --- a/Rakefile > +++ b/Rakefile > @@ -55,13 +55,15 @@ task :ragel do > Dir.chdir "ext/http11" do > target = "http11_parser.c" > File.unlink target if File.exist? target > - sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}" > + # sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}" # ragel 5.x > + sh "ragel -G2 http11_parser.rl" # ragel 6.0 > raise "Failed to build C source" unless File.exist? target > end > Dir.chdir "ext/http11" do > target = "../../ext/http11_java/org/jruby/mongrel/Http11Parser.java" > File.unlink target if File.exist? target > - sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}" > + # sh "ragel -J http11_parser.java.rl | rlgen-java -o #{target}" # ragel 5.x > + sh "ragel -J -o #{target} http11_parser.java.rl" # ragel 6.0 > raise "Failed to build Java source" unless File.exist? target > end > end > diff --git a/ext/http11/http11_parser.rl b/ext/http11/http11_parser.rl > index a418605..0c4e2d4 100644 > --- a/ext/http11/http11_parser.rl > +++ b/ext/http11/http11_parser.rl > @@ -114,7 +114,7 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, > p = buffer+off; > pe = buffer+len; > > - assert(*pe == '\0' && "pointer does not end on NUL"); > + /* assert(*pe == '\0' && "pointer does not end on NUL"); */ > assert(pe - p == len - off && "pointers aren't same distance"); > > > @@ -130,23 +130,11 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, > assert(parser->field_len <= len && "field has length longer than whole buffer"); > assert(parser->field_start < len && "field starts after buffer end"); > > - if(parser->body_start) { > - /* final \r\n combo encountered so stop right here */ > - %%write eof; > - parser->nread++; > - } > - > return(parser->nread); > } > > int http_parser_finish(http_parser *parser) > { > - int cs = parser->cs; > - > - %%write eof; > - > - parser->cs = cs; > - > if (http_parser_has_error(parser) ) { > return -1; > } else if (http_parser_is_finished(parser) ) { > @@ -161,5 +149,5 @@ int http_parser_has_error(http_parser *parser) { > } > > int http_parser_is_finished(http_parser *parser) { > - return parser->cs == http_parser_first_final; > + return parser->cs >= http_parser_first_final; > } > -- > > > Eric Wong > _______________________________________________ > Mongrel-development mailing list > Mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org > http://rubyforge.org/mailman/listinfo/mongrel-development > -- Evan Weaver Cloudburst, LLC