mirror of mongrel-development@rubyforge.org (inactive)
 help / color / mirror / Atom feed
From: Tony <tony-INw5wk3xIkAIjDr1QQGPvw@public.gmane.org>
To: mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
Subject: Pure Ruby HTTP parser
Date: Wed, 23 Apr 2008 18:50:14 -0600	[thread overview]
Message-ID: <c7e6b2b00804231750o1c86d377i25c83d5e99f41dd1@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1206 bytes --]

Before anything else, let me state this: Of course it's going to be
PAINFULLY slow on MRI.  That's not the point :)

I thought I'd try out writing out a Ruby version of the parser for the
purposes of Rubinius.  For those of you who aren't aware, Ragel supports a
goto-driven FSM on Rubinius by injecting assembly directly, and Rubinus head
honcho guy Evan Phoenix is working on a patch for Ragel to update it to the
new compiler semantics.  So really, there is a purpose for trying this out.

Anyway, here's my initial hack.  It's nasty, and presently jams the entire
FSM into instance-specific data.  Aieee!  But it more or less seems to
generate similar (albeit not identical) output to the C one:

http://git.rubini.us/?p=code;a=blob;f=lib/mongrel/http11_parser.rb.rl;h=508f9bd42b4aad322f357637d52576f780707a2f;hb=868732662abbf4aa571bf2f3d598152467f6f4da

I've thought about having a Mongrel::HttpParser::FSM module to store the
actual Ragel-generated state machine, and pass all ivars from the
Mongrel::HttpParser to an execute method then recapture them as return
values, or something to that effect.

Thoughts?  Suggestions?  Complete rewrites?  I'd appreciate them all.

-- 
Tony Arcieri
medioh.com

[-- Attachment #1.2: Type: text/html, Size: 1532 bytes --]

[-- Attachment #2: Type: text/plain, Size: 199 bytes --]

_______________________________________________
Mongrel-development mailing list
Mongrel-development-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/mongrel-development

             reply	other threads:[~2008-04-24  0:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-24  0:50 Tony [this message]
     [not found] ` <c7e6b2b00804231750o1c86d377i25c83d5e99f41dd1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-04-24 11:38   ` ry dahl
     [not found]     ` <3ae7f4480804240438g62ed7190if2a84ff08dd2fe34-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-04-26 23:33       ` Tony
     [not found]         ` <c7e6b2b00804261633y2835329eqaa1b0190e19f59ac-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-04-26 23:57           ` Luis Lavena
2008-05-06  6:27       ` Zed A. Shaw
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).