Directly outputting for large templates
j-w-jones opened this issue · 3 comments
Hi,
I have a few templates whose output is very long and I think the render() method captures all the output in a string before finally outputting it, which consumes a lot of memory.
Is there any way to get the template engine to print the output as it is generated?
Thanks,
Jason
Sorry - having re-read my original post, I can see it could be confusing..
If I have a simple template that outputs 100Mb+ of text using a number of loops etc, the current implementation will store that entire output in a string in memory until the end of execution. The string would then be displayed on stdout. This means a simple template could end up using 100Mb+ of RAM.
Would there be a way of enabling the output from the template to be displayed immediately, rather than buffered in this way?
Perhaps we should add somekind of streaming support and move to use LuaJIT string buffer (some things might be hard with that though, e.g. if using master pages etc. which we need to check if they are rendered lazily or not).