httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf S. Engelschall" <>
Subject Re: stack depth perusal
Date Sun, 31 May 1998 10:42:45 GMT
In article <> you wrote:

> mod_rewrite:
>     Ralf wins the "I like to copy data around and around and around"
>     award :)  Consider apply_rewrite_rule().  It has two stack buffers
>     newuri[MAX_STRING_LENGTH] and env[MAX_STRING_LENGTH].  For both
>     of them there's a bunch of calls to expand_backref_inbuffer(),
>     expand_variables_inbuffer(), and so on.  Each of those expand routines
>     does a bunch of their work through routines such as ap_pregsub(), and
>     ap_pstrdup(), which create dynamically allocated strings... and then
>     the results are *copied back* to the static-sized buffer.  And then
>     finally when the gymnastics are done, there's a pstrdup(r->pool,
>     newuri) and such... which makes one last dynamic copy :)

>     Ralf you could probably get a 4X url rewriting speed improvement
>     with a little work cleaning this up.

Hmmm... yes seems this multiple data copies and allocation are a relict of the
old Apache 1.0/1.1 days where the things were done differently. We then just
have moved the code to the new ap_xxx functions etc. but never optimized the
stuff. Thanks for the hint, Dean. if you've already a concrete patch feel free
to post it. Else I'll try to jump into this stuff the next weeks and try to
optimize it a little bit by cleaning it up. Nevertheless thanks for
discovering this. And, BTW, when do I receive the award? ;-)

                                       Ralf S. Engelschall

View raw message