Quantcast
Channel: Nginx Forum
Viewing all articles
Browse latest Browse all 53287

Re: Why nginx's http parser doesnt use regular expressions?

$
0
0
Thanks for the reply.

I have another question, was any state machine generators like ragel used
to code this or this is completely hand written?


Anshuk

On Mon, Jun 24, 2013 at 4:21 PM, Maxim Dounin <mdounin@mdounin.ru> wrote:

> Hello!
>
> On Sun, Jun 23, 2013 at 11:16:21AM +0530, anshuk kumar wrote:
>
> > This is in reference to the following code
> >
> > https://github.com/joyent/http-parser
> >
> > What could be the main reason for such a design decision? I guess I could
> > write few regular expressions to parse HTTP req & res this would be a lot
> > less complex than Igor's version of the parser.
> >
> > What am I missing here?
>
> Regular expressions isn't something readily available when you
> code in C, nor something which can be easily used to parse data
> available in chunks. It's also highly unlikely that even
> carefully coded regular expressions will be able to beat C code in
> terms of performance.
>
> Of course if you are coding some simple http server in perl or
> javascript - using regular expressions is a way to go. But it's
> unlikely a good choise if you are coding high performance web
> server in C.
>
> --
> Maxim Dounin
> http://nginx.org/en/donation.html
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Viewing all articles
Browse latest Browse all 53287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>