On Thu, 2007-06-14 at 12:23 -0700, Brian Harring wrote: > Just filed ticket 4565, which basically converts template rendering > away from "build a string within this node of subnode results, return > it, wash rinse repeat", and into "yield each subnode chunk, and my > data as it's available". > > The pros of it are following (copy/pasting from the ticket): > > * instant results; as long as you don't have any tags/nodes that > require collapsing their subtree down into a single string, data is > sent out immediately. Rather nice if you have a slow page- you start > getting chunks of the page immediately, rather then having to wait for > the full 10s/whatever time for the page to render. > > * Far less abusive on memory; usual 'spanish inquisition' heavy > test test (term coined by mtreddinick, but it works), reduction from > 84m to 71m for usage at the end of rendering. What I find rather > interesting about that reduction is that the resultant page is 6.5 > mb; the extra 7mb I'm actually not sure where the reduction comes > from (suspect there is some copy idiocy somewhere forcing a new > string)- alternatively, may just be intermediate data hanging around, > since I've been working with this code in one form or another for 3 > months now, and still haven't figured out the 'why' for that diff.
There was one subtle bug whose fix negates these improvements in some cases: if any middleware needs access to the contents of the response, we need to store a copy of the stringified response content. Since the iterator version isn't rewindable, you get to access the iterators once only. That's handled automatically, though, so it's only a penalty in the necessary cases and never a development burden. Other than that (and a few minor formatting things), the patch was fine. All committed now -- along with protection against infinite looping in render(). Thanks, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---