FYI, we got rid of the Executor pattern in the events API, and we now always provide the current Context when calling handlers.

On 29/11/2016 23:25, Alex Fedotov wrote:
[...]
We have run into some other inefficient places. For example
ASTStringLiteral is buffering the entire content in the StringWriter. It
does not work very well for large templates.
That code creates a writer which buffers up the whole thing, then does a
toString() on it creating another copy. Then in some cases calls
substring() that creates yet another copy.

The  substring belonged to an old workaround, it has been removed.

The StringWriter buffering is only done when interpolation is needed (that is, when the string literal is enclosed in double quotes and has some $ or # inside). There could be some tricky ways of introducing some kind of lazy evaluation, that would resort to using the provided final writer when the value is meant to be rendered or to a buffered writer otherwise. But I'm not sure it is worth it, because it looks rather fragile and convoluted. Plus, you can generally avoid having big string literals. I don't know about your use case, but why can't something as:

    #set($foo = "#parse('big.vtl')") $foo

be rewritten as:

    #parse('big.vtl')

to avoid the buffering?


  Claude



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to