Re: Performance cost of conf.addAutoImport

"Jeremy Chone" <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Great, tx.

Some auto imported macros might call Java or TemplateMethods, but this will
happen only at invocation time. Is other word, the auto imported templates
will just have macro definition and won't execute anything.

Thank you.

Jeremy,

On Mon, Jun 23, 2008 at 7:34 PM, Jonathan Revusky <[email protected]> wrote:

> On Tue, Jun 24, 2008 at 2:59 AM, Jeremy Chone <[email protected]>
> wrote:
> > Hi,
> >
> > I would like to know the performance impact of addAutoImport methods.
> > Basically, I would like to have a library of macros available forall my
> > templates, but these macros might be used only in very few of them. I
> might
> > have a lot templates (10 to 30) for each request (HTTPRequest).
> >
> > What is the performance cost of addAutoImport? Should I build logic to
> try
> > to minimize the autoImport?
>
> Nah, almost certainly not.
>
> > I am planning to autoImport only one file with 5
> > to 10 macros max.
>
> I haven't really tested this, but I think the performance cost of
> auto-importing an infrequently used macro library with 5 to 10 macros
> in it is very very (very very :-)) small. Maybe something on the order
> of a hashmap.put() or two per macro.
>
> And I don't think there would be very much difference between
> autoimporting a single big macro library versus many smaller ones,
> though again, I haven't tested it.
>
> Now that I think about it, I actually suspect that within reasonable
> parameters, you could think of autoImporting as basically being free.
> The one case I could imagine where it would be costly is if your macro
> library contains something like:
>
> <#assign myVariable = someVeryCostlyTimeConsumingMethod()>
>
> i.e. calling a java method that is very expensive. Other than that, I
> can't see the problem. If the template just contains macros, it's
> basically just running over them and putting them in a hashmap, so you
> know, the cost is trivial.
>
>
> JR
>
> >
> >
> > Jeremy,
> >
> >
> > -------------------------------------------------------------------------
> > Check out the new SourceForge.net Marketplace.
> > It's the best place to buy or sell services for
> > just about anything Open Source.
> > http://sourceforge.net/services/buy/index.php
> > _______________________________________________
> > FreeMarker-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/freemarker-user
> >
> >
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> FreeMarker-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
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.