Re: High performance with stateful TemplateDirectiveModel

Daniel Dekany <[email protected]> Mon, 15 Dec 2014 16:46:05 +0100
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Yip, I know this problem, and I have just added a feature that targets
this and some more. Check out CachingUpperCaseDirective here:
https://github.com/freemarker/freemarker/blob/2.3-gae/src/test/java/freemarker/core/DirectiveCallPlaceTest.java

It will be a new feature in 2.3.22, which should be released in early
2015. So, for now you have to build it from the GitHub 2.3-gae branch
(it's important that it's the "gae" one), and please do so if you can,
and try to use it, and break it. I'm open for new suggestions of
course, until it's released.

(I would say that the 2.3-gae head is pretty safe to use in
production, in case waiting for the be release is a problem. The new
API-s and features can change a bit though.)

Monday, December 15, 2014, 9:42:19 AM, Jerker Klang wrote:

> Hello all,
>
> I'd thinking about how I could attain template "compile time generation"
> optimizations the best way. Or maybe I'm just on the wrong track. Any 
> comments would be helpful.
>
> I'm using Freemarker as html template engine. In that html I have 
> sometimes a few <script>-tags containing javascript. The javascript 
> could be optimized with one of numerous available optimization and 
> minification tools available. I was thinking about doing a 
> TemplateDirectiveModel that on the first run optimizes that code and any
> calls thereafter only returns the optimized part. Is this a good way to
> attain my goal (doing early, close to only once, expensive template 
> translation). Of course the code within has to be written so it doesn't
> depend on anything that makes the code dynamic on each rendering.
>
> As I said, any feedback on my thoughts would be greatly appreciated!
>
> Have a great day!
>
> //Jerker
>

-- 
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk