[Zope3-dev] Re: URGENT RFC: Is anyone using response.write in Zope 3?

Shane Hathaway shane at hathawaymix.org
Fri Dec 30 14:05:27 EST 2005


Philipp von Weitershausen wrote:
> Shane Hathaway wrote:
>>So I fully agree that the original write() should go (in fact I suppose
>>it's gone already), but to say there was no performance advantage is
>>imprecise.  I spent a fair amount of time making write() fast, with some
>>success.
> 
> 
> Interesting. Where exactly did this effort of making write() fast go
> into? Looking at X3 3.0's response.write() method, I basically see:
> 
>     def write(self, string):
>         self._outstream.write(string)
> 
> So using write() once doesn't at all seem like an advantage over simply
> returning the data...

The interesting part is behind the scenes.  If the response is large 
enough (it's an adjustable threshold), the response transparently gets 
sent to a temporary file.  If the load on the server doesn't allow
all the responses to fit in RAM, temporary files are an advantage 
because they allow the kernel to help manage the memory.  (CPython's 
manner of using memory makes it hard for the kernel to page most memory 
held by Python processes.)

However, as I said earlier, there was only advantage if a lot of 
conditions were met.  Those conditions were often met by Zope 
Corporation customers.

Shane


More information about the Zope3-dev mailing list