I've run into a curious blank wall here:

I'm rendering a page, basically consisting of an HTML table of results
plus various fluff. In order to generate these results, I fire off an
asynchronous operation to which I pass a callback; the callback is then
invoked once per result, corresponding to a row in the resulting table.
Currently I'm just firing the operation off in beforeRender, building up
a list as an instance attribute on the class in question, and then
preceeding with the rendering, using that list in a renderer later.

For small result sets, this works fine; however, I'm now running into
situations where I have over 10k rows in the resulting table. Under
these circumstances, holding all this data in memory and then rendering
it all at once incurs a rather large and unnecessary memory overhead;
also, there is a large delay between the client's request, and the
response document beginning to be streamed.

I'd like to start streaming the document as soon as I start receiving
the results of the operation, but I'm stumped on how to actually
implement this. If I return a deferred from the render method, I cannot
fire this deferred until all of the rows have been built up.

Any ideas? I'm sure I've overlooked something obvious here, but I'm
drawing a complete blank.
-- 
mithrandi, i Ainil en-Balandor, a faer Ambar

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Reply via email to