Re: 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, Daniel. Thanks for your answers.


On Fri, 2011-01-14 at 11:29 +0100, Daniel Dekany wrote:
> You could avoid all the re-instantiations of the
> DynamicTagLibDirective if you just put them into the Configuration as
> a shared hash variable "g" (see setSharedVariable), which stores the
> DynamicTagLibDirective objects. Thus these objects will be created
> only once during the whole application life-cycle (when you set up the
> Configuration object). 

	Will this also work for functions/methods (besides directives)?


> Also then auto-importing is not needed. OTOH
> then a "g" in the data-model will shadow the "g" shared variable. (To
> work that around, you can also add "g" with an additional name, like
> "grails_tags", so you can say <#assign g = grails_tags> in the
> template, hence shadowing the clashing "g" in the data-model. More
> tricky than an import, but then, this accident will also occur
> rarely.)
> 
> 

	About this, even when i use

[#assign message
="org.codehaus.groovy.grails.plugins.freemarker.DynamicTagLibDirective"?new("g", "message")]

(...)

[#import "g.ftl" as g]

	If the script tries to change the value of "g"

[#assign g={"message": "anything"}]

	Won't i lost its original value?


	Thanks in advance!


------------------------------------------------------------------------------
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.