Possible room for performance improvement when using TemplateDirectiveModel and TemplateMethodModelEx

Daniel Henrique Alves Lima <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
	Hi, everybody. 	

	My context is Grails freemarker-tags plugin.
	First a quick explanation about how the plugin works:

	At the startup, the plugin
	- Creates a MultipleTemplateLoader that contains a
StringTemplateLoader;
	- Collects all Grails TagLibs that share the same namespace (for
instance "g" namespace);
	- For each namespace, it creates a "namespace.ftl_suffix" (for our
example, a "g.ftl" template) that contains lines like

[#assign message
="org.codehaus.groovy.grails.plugins.freemarker.DynamicTagLibDirective"?new("g", "message")]
[#assign _message
="org.codehaus.groovy.grails.plugins.freemarker.DynamicTagLibFunction"?new("g", "message")]
	
	(these DynamicTagLibXYZ are adapters that know how to locate and
execute Grails TagLibs)

	- The created templates are added to StringTemplateLoader and are
marked, in Configuration object, to be "auto imported".


	That is all.

	Every time a .ftl is called, a lot of instances of
DynamicTagLibDirective and DynamicTagLibFunction are created and
everything works fine (most of the time ;-)). FreeMarker cache seems to
be in use, as expected:

2011-01-14 06:32:01,604 [http-8080-4] DEBUG freemarker.cache  -
g.ftl[en_US,UTF-8,parsed] using cached since
freemarker.cache.StringTemplateLoader$StringTemplateSource@5c1eb57
didn't change.


	I've added options to turn off auto-import and to turn off function
definitions.
	Related to FreeMarker, is there any other performance improvement that
i could/should consider? Is it possible to avoid some object creation?


	Thanks in advance.

http://code.google.com/p/grails-freemarker-tags-plugin/source/browse/


-- 
"If there must be trouble, let it be in my day, 
 that my child may have peace."

Thomas Paine


------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.