[Zope-dev] ZPT Optimization Opportunity

Tres Seaver tseaver at zope.com
Mon Sep 27 14:00:30 EDT 2004


Dieter Maurer wrote:
> Tres Seaver wrote at 2004-9-27 11:25 -0400:
> 
>>...
>>  - Returning the iterator to medusa means that the application
>>    thread becomes available to service other threads that much more
>>    quickly.  Even if the malloc issues can't be demonstrated, the
>>    increase in concurrency *should* be a win here.
> 
> 
> Unless you generate huge results (which you probably should not do
> in the first place as the browser, too, will need even more memory)
> allocation and copying will be so fast that you should not see
> a significant effect.
> 
> On my computer allocating and copying a string costed
> 
>    10 MB		  0.048 s
>   100 MB		  0.487 s
> 
> measured with the following function:
> 
> 
>>>>from time import time
>>>>def copy(n):
> 
> ...   s = 'a'*n
> ...   st = time(); sx = s[:-1]; return time()-st
> 
> 
> You do not need this optimization for PageTemplates
> -- only for large files.

As I said earlier in the thread, I don't believe the win will show up at 
all in the "easy test rig" case:  only systems which are already either 
memory-constrained or else have fragmented heaps show the non-linearity 
for allocating the large blocks.


Tres.
-- 
===============================================================
Tres Seaver                                tseaver at zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com


More information about the Zope-Dev mailing list