Re: Performance and custom tags w/buffers=True

Philip Semanchuk <[email protected]>
Newsgroups gmane.comp.python.spyce.general
Message-ID <[email protected]>
On Apr 7, 2006, at 10:28 AM, Jonathan Ellis wrote:

> On Thu, 6 Apr 2006 16:55:34 -0400, "Philip Semanchuk"
> <[email protected]> said:
>> Hi all,
>> I've been using Spyce in command line mode to generate reports. The
>> runtime suddenly ballooned and I tracked it down to a custom tag I had
>> written. Further experimentation showed that the tag behaved very
>> differently (performance-wise) depending on whether or not I set
>> buffers=True in the tag definition. I wrote a short page to illustrate
>> the problem:
>
>> Can anyone else (a) repeat these results and, better yet, (b) explain
>> what's going on?
>
> Well, the core buffer code is pretty much unchanged since 1.3, but
> compiling tags with buffering is relatively new.  Rimon was something
> of a performance nazi, so my guess is it's the compiled code's fault,
> rather than the execution model, but it may be worth testing that
> assumption.
>
> In any case, you can see the difference in the generated code, both
> for your page and the tag, by running spyceCompile from the command
> line.  (I don't think the page code will be any different, but
> I wouldn't place too much faith in my memory for that, either. :)

Thanks, Jonathan. I had a look at the generated code last night and the 
two versions differ, but not in any substantial way that I could see. I 
think the buffers=True version created the request, response, stdout 
and error objects in the body() function whereas the buffers=False 
version moved that code to the begin() function. It didn't seem to me 
that that would make any difference in performance.

This behavior isn't a big deal to me since custom tags are just a 
convenience and I can replace them with a bit of code, but the big 
performance hit seems like a trap for the unwary. At least now it is 
documented (sort of).

BTW I neglected to mention that I see this behavior on my 
FreeBSD/Python 2.4/x86 machine as well as under OS X/Python 2.3/PPC.

bye
Philip






-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.