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. -- Dieter