[Mongrel-development] query string parsing C extension

ry dahl ry at tinyclouds.org
Thu Sep 27 15:35:31 EDT 2007


Hey all,

here is a less hacky version of the query string C extension I posted before.
http://s3.amazonaws.com/four.livejournal/20070927/qsp.tar.bz2

It uses an http11-like interface to the state machine. the
escape/unescape functions are also slightly more libraryish.

again, here is the about benchmark results. it seems to be about 10
times faster than the ruby functions. i've seen query_parse pop up in
profiles of merb, one can except on query string intensive actions
(forms) that this would noticeably speed up the app.

     user     system      total        real
escape: Single long
M:  1.710000   0.030000   1.740000 (  2.192255)
Q:  0.020000   0.010000   0.030000 (  0.032105)
escape: Many small
M:  2.670000   0.030000   2.700000 (  3.288974)
Q:  0.270000   0.000000   0.270000 (  0.333991)
unescape: Single long
M:  2.500000   0.030000   2.530000 (  3.688766)
Q:  0.020000   0.010000   0.030000 (  0.028780)
unescape: Many small
M:  3.380000   0.030000   3.410000 (  3.785195)
Q:  0.260000   0.000000   0.260000 (  0.323243)
query_parse: one long query
M:  3.720000   0.090000   3.810000 (  4.513557)
Q:  0.460000   0.020000   0.480000 (  0.556755)
query_parse: many short query strings
M:  5.960000   0.070000   6.030000 (  7.212142)
Q:  0.900000   0.010000   0.910000 (  1.058425)
query_parse: deeply nested query
M:  0.000000   0.000000   0.000000 (  0.000247)
Q:  0.000000   0.000000   0.000000 (  0.001138)


ry


More information about the Mongrel-development mailing list