hi,
I rewrote escape, unescape, and query_parse in a C extension.
http://s3.amazonaws.com/four.livejournal/20070922/http_helpers.tar.bz2
Here are some sample benchmarks (the benchmark script is included in
the package)
user system total real
escape: Single long
Mongrel: 1.680000 0.020000 1.700000 ( 1.837793)
HttpHlp: 0.030000 0.010000 0.040000 ( 0.036590)
escape: Many small
Mongrel: 2.580000 0.020000 2.600000 ( 2.751985)
HttpHlp: 0.290000 0.010000 0.300000 ( 0.353808)
unescape: Single long
Mongrel: 2.490000 0.030000 2.520000 ( 2.659217)
HttpHlp: 0.030000 0.010000 0.040000 ( 0.238297)
unescape: Many small
Mongrel: 3.400000 0.030000 3.430000 ( 3.952430)
HttpHlp: 0.280000 0.000000 0.280000 ( 0.344116)
query_parse: one long query
Merb: 0.350000 0.010000 0.360000 ( 0.518884)
HHlp: 0.020000 0.000000 0.020000 ( 0.023698)
query_parse: many short query strings
Merb: 5.970000 0.060000 6.030000 ( 7.105239)
HHlp: 0.710000 0.010000 0.720000 ( 0.893846)
query_parse: deeply nested query
Merb: 0.000000 0.000000 0.000000 ( 0.000242)
HHlp: 0.000000 0.000000 0.000000 ( 0.000047)
My query_parse implements a different behavior than Mongrel has.
Mongrel interprets "q[a]=b" to be { 'q[a]' => 'b' }. Instead the C
extension mimic's Merb's behavior, creating nested hashes.
I think mongrel should change the behavior of it's query_parse
function and use a C implementation. HttpHelpers.query_parse also uses
a ragel state machine, so it shouldn't be increadably hard to put this
query_parse directly into http11.
Is there a development branch of mongrel? What should I patch against?
What do people feel about how query_parse should behave? Should it
happen automatically as Mongrel parses the rest of the query? Should
it by default use the Merb hash syntax?
ry
_______________________________________________
Mongrel-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-users