Re: High performance with stateful TemplateDirectiveModel
Jerker Klang <[email protected]> Tue, 16 Dec 2014 10:09:14 +0700
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Daniel! Interesting and useful. I'll check it out as soon as I get some time for it. I'm not sure I can use the isNestedOutputCachable() feature since some of the content that I want to cache may contain things that are using dynamic expressions (like including a constant that is environment specific). Still the whole new feature is interesting. Thanks! //Jerker On 12/15/2014 10:46 PM, Daniel Dekany wrote: > 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 >> ------------------------------------------------------------------------------ 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