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.

	Yes, it is a micro-benchmark, but .ftl rendering seems also slower for
the original (whole) template. I've cut down the template until only
those @g.message lines remains. If i'm not wrong, g.message searches
message at Resource Bundle files.
	I've already develop a option to turn off auto-import so i don't
believe this is causing the issue. I can test other tags usage or the
original template again.


	Thanks.

	Best regards,

		Daniel.


On Sun, 2011-01-16 at 12:51 +0100, Daniel Dekany wrote:

> 
> Well, it looks like a micro-benchmark, so everything is possible. I
> mean, what does g.message do? If almost nothing, like only a
> HashMap.get, then it's easily possible to get a 5x slowdown figure.
> Like, you are *capturing* output here, which involves collecting into
> a StringBuffer, which is much much slower than assigning the result of
> an expression to variable (like [#assign entityName =
> g.message(...)]). Plus you might have a startup overhead (especially
> if you have auto-#import) that can be comparable to the actual
> execution time of the template. So on, so on... Actually, if you are
> going to assemble Web pages from hundreds of little independent
> templates (i.e., you call cfg.getTemplate(...).process(...) for each
> of them), I don't think FreeMarker fits the task.



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