FreeMarker vs. GSP for Dynamic Template Rendering

classic Classic list List threaded Threaded
34 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: FreeMarker vs. GSP for Dynamic Template Rendering

Daniel Henrique Alves Lima
        I think i can use some help here. This seems to be responsible for all
spent time:

        tagLib.setProperty(TagLibDynamicMethods.OUT_PROPERTY, ...);

      Maybe i need to do some clean up after usage. I've developed
based on JspInvokeGrailsTagLibTag.java but i can be missed something.

https://code.google.com/p/grails-freemarker-tags-plugin/source/browse/trunk/src/groovy/org/codehaus/groovy/grails/plugins/freemarker/DynamicTagLibDirective.groovy


        Any ideas?

        Thanks.


On Sat, 2011-01-15 at 10:22 -0200, Daniel Henrique Alves Lima wrote:

> Ok, Chee Kin.
>
> But i'm not sure if FreeMarker is the culprit in Lari's test.
> FreeMarker Tags plugin could be responsible for that (or the way it
> works). I've noticed that if you write a template and repeat the same
> tag N times, in both .ftl and .gsp, .ftl performance will be the worst.
> If you add the same tag again and again, .ftl rendering will get worse
> and worse.
>
>
> Best regards,
>
> Daniel.
>
>



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: FreeMarker vs. GSP for Dynamic Template Rendering

Daniel Henrique Alves Lima
        If i'm not crazy and profiler is not fooling me (attached files), 80%
of time is spent in tagLib.setProperty. setProperty seems to be a method
of GroovyObject. Is there something special about it?
       
       
        Thanks.


On Sat, 2011-01-15 at 18:32 -0200, Daniel Henrique Alves Lima wrote:

> I think i can use some help here. This seems to be responsible for all
> spent time:
>
> tagLib.setProperty(TagLibDynamicMethods.OUT_PROPERTY, ...);
>
>       Maybe i need to do some clean up after usage. I've developed
> based on JspInvokeGrailsTagLibTag.java but i can be missed something.
>
> https://code.google.com/p/grails-freemarker-tags-plugin/source/browse/trunk/src/groovy/org/codehaus/groovy/grails/plugins/freemarker/DynamicTagLibDirective.groovy
>
>
> Any ideas?
>
> Thanks.
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Screenshot-Profiler4j Console 1.0-beta2 (build 27).png (52K) Download Attachment
Screenshot-Profiler4j Console 1.0-beta2 (build 27)-1.png (122K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FreeMarker vs. GSP for Dynamic Template Rendering

Daniel Henrique Alves Lima
        Any GSP expert? I know very little about it :-/

        setProperty is triggering


            mc.setOut = {Writer newOut ->
                GroovyPageOutputStack.currentStack().push(newOut,true)
            }

        inside GroovyPagesGrailsPlugin.groovy

       
        And 70% of the time is wasted here. Tag execution through FreeMarker is
consuming only 30%.

        How can i improve GroovyPageOutputStack usage?

        Thanks in advance.


On Sat, 2011-01-15 at 21:54 -0200, Daniel Henrique Alves Lima wrote:

> If i'm not crazy and profiler is not fooling me (attached files), 80%
> of time is spent in tagLib.setProperty. setProperty seems to be a method
> of GroovyObject. Is there something special about it?
>
>
> Thanks.
>
>
> On Sat, 2011-01-15 at 18:32 -0200, Daniel Henrique Alves Lima wrote:
> > I think i can use some help here. This seems to be responsible for all
> > spent time:
> >
> > tagLib.setProperty(TagLibDynamicMethods.OUT_PROPERTY, ...);
> >
> >       Maybe i need to do some clean up after usage. I've developed
> > based on JspInvokeGrailsTagLibTag.java but i can be missed something.
> >
> > https://code.google.com/p/grails-freemarker-tags-plugin/source/browse/trunk/src/groovy/org/codehaus/groovy/grails/plugins/freemarker/DynamicTagLibDirective.groovy
> >
> >
> > Any ideas?
> >
> > Thanks.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
--
"If there must be trouble, let it be in my day,
 that my child may have peace."

Thomas Paine


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: FreeMarker vs. GSP for Dynamic Template Rendering

Lim Chee Kin
Hi Daniel,

Thanks for writing and taking your time/effort to improve freemarker-tags plugin.

I suggest you create a new topic for your GSP question and post the link here, as I think most GSP experts out there are overlook your question (I don't think they are still following this topic).

Regards,
Chee Kin




On Sun, Jan 16, 2011 at 8:51 AM, Daniel Henrique Alves Lima [via Grails] <[hidden email]> wrote:
        Any GSP expert? I know very little about it :-/

        setProperty is triggering


            mc.setOut = {Writer newOut ->
                GroovyPageOutputStack.currentStack().push(newOut,true)
            }

        inside GroovyPagesGrailsPlugin.groovy

       
        And 70% of the time is wasted here. Tag execution through FreeMarker is
consuming only 30%.

        How can i improve GroovyPageOutputStack usage?

        Thanks in advance.


On Sat, 2011-01-15 at 21:54 -0200, Daniel Henrique Alves Lima wrote:

> If i'm not crazy and profiler is not fooling me (attached files), 80%
> of time is spent in tagLib.setProperty. setProperty seems to be a method
> of GroovyObject. Is there something special about it?
>
>
> Thanks.
>
>
> On Sat, 2011-01-15 at 18:32 -0200, Daniel Henrique Alves Lima wrote:
> > I think i can use some help here. This seems to be responsible for all
> > spent time:
> >
> > tagLib.setProperty(TagLibDynamicMethods.OUT_PROPERTY, ...);
> >
> >       Maybe i need to do some clean up after usage. I've developed
> > based on JspInvokeGrailsTagLibTag.java but i can be missed something.
> >
> > https://code.google.com/p/grails-freemarker-tags-plugin/source/browse/trunk/src/groovy/org/codehaus/groovy/grails/plugins/freemarker/DynamicTagLibDirective.groovy
> >

> >
> > Any ideas?
> >
> > Thanks.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
--
"If there must be trouble, let it be in my day,
 that my child may have peace."

Thomas Paine


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





View message @ http://grails.1312388.n4.nabble.com/FreeMarker-vs-GSP-for-Dynamic-Template-Rendering-tp3213939p3219638.html

To unsubscribe from FreeMarker vs. GSP for Dynamic Template Rendering, click here.

Reply | Threaded
Open this post in threaded view
|

Re: FreeMarker vs. GSP for Dynamic Template Rendering

Daniel Henrique Alves Lima
        Try this one using your original test:

http://grails-freemarker-tags-plugin.googlecode.com/files/grails-freemarker-tags-0.5.7.zip


        After that, please, try using Lari's version.

        Thanks!


On Sat, 2011-01-15 at 18:27 -0800, Lim Chee Kin wrote:

> Hi Daniel,
>
> Thanks for writing and taking your time/effort to improve
> freemarker-tags plugin.
>
> I suggest you create a new topic for your GSP question and post the
> link here, as I think most GSP experts out there are overlook your
> question (I don't think they are still following this topic).
>
> Regards,
> Chee Kin
(...)


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: FreeMarker vs. GSP for Dynamic Template Rendering

Daniel Henrique Alves Lima
        Hi, everybody.

        First of all, i apologize for the cross posting. I'll explain (in few
words, i hope) what was going on.

        As JspInvokeGrailsTagLibTag, FreeMarker Tags Plugin calls
tagLib.setProperty('out', newOut) or tagLib.out = newOut, but this
triggers setOut closure execution (the closure is defined in
GroovyPagesGrailsPlugin). setOut closure, in the other hand, invokes
GroovyPageOutputStack.push(newOut, true); push() method adds newOut to a
stack and performs the following verification:

        if (checkExisting) { // checkExisting == true
            for (WriterPair item : stack) {
                if (item.originalTarget == newWriter) {
                    log.warn("Pushed a writer to stack a second time.
Writer type " +
                            newWriter.getClass().getName(), new
Exception());
                        /* Maybe a break statement here could avoid this performance issue.
*/
                }
            }
        }

       
        But FreeMarker Tags Plugin do not remove newOut from the stack (because
i hadn't any idea that something would add newOut object to a stack),
and the stack was growing "forever", causing exponential degradation of
the performance in Lari's version of the micro-benchmark test.
        Now, at every execution of a Grails TagLib, the plugin invokes
GroovyPageOutputStack.pop() and everything seems fine.


        The results are:

        == Chee Kin original version ==
FreeMarker vs. GSP for Dynamic Template Rendering

      * FreeMarker 100 times completed in 3838ms.
      * GSP 100 times completed in 138115ms.


        == Lari's version ==
FreeMarker vs. GSP for Dynamic Template Rendering

      * FreeMarker 1000 times completed in 5022ms.
      * GSP 1000 times completed in 2977ms.


        I won't release a new version of the plugin for now, because i want to
include a minor modification based in something that Daniel Dekany had
commented.


        The unofficial version (used in the tests) is here:
http://grails-freemarker-tags-plugin.googlecode.com/files/grails-freemarker-tags-0.5.7.zip


        Best regards,

                Daniel.



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: FreeMarker vs. GSP for Dynamic Template Rendering

Lim Chee Kin
Hi Daniel,

Thanks for further writing and released the unofficial version freemarker-tags 0.5.7. I will run both my test and Lari's test when I find time to do so afterward.

I will keep you inform about the test result.

Also, I am sure FreeMarker have it's value over GSP as commented by some users in previous responses such as E-mail Templating and Page Templating, when you open up template editing function to regular user, GSP is not the way to go as user can input Groovy scriptlet into the template, it is great security risk.

Just my 2 cents.

Regards,
Chee Kin





On Mon, Jan 17, 2011 at 8:03 AM, Daniel Henrique Alves Lima [via Grails] <[hidden email]> wrote:
        Hi, everybody.

        First of all, i apologize for the cross posting. I'll explain (in few
words, i hope) what was going on.

        As JspInvokeGrailsTagLibTag, FreeMarker Tags Plugin calls
tagLib.setProperty('out', newOut) or tagLib.out = newOut, but this
triggers setOut closure execution (the closure is defined in
GroovyPagesGrailsPlugin). setOut closure, in the other hand, invokes
GroovyPageOutputStack.push(newOut, true); push() method adds newOut to a
stack and performs the following verification:

        if (checkExisting) { // checkExisting == true
            for (WriterPair item : stack) {
                if (item.originalTarget == newWriter) {
                    log.warn("Pushed a writer to stack a second time.
Writer type " +
                            newWriter.getClass().getName(), new
Exception());
                        /* Maybe a break statement here could avoid this performance issue.
*/
                }
            }
        }

       
        But FreeMarker Tags Plugin do not remove newOut from the stack (because
i hadn't any idea that something would add newOut object to a stack),
and the stack was growing "forever", causing exponential degradation of
the performance in Lari's version of the micro-benchmark test.
        Now, at every execution of a Grails TagLib, the plugin invokes
GroovyPageOutputStack.pop() and everything seems fine.


        The results are:

        == Chee Kin original version ==
FreeMarker vs. GSP for Dynamic Template Rendering

      * FreeMarker 100 times completed in 3838ms.
      * GSP 100 times completed in 138115ms.


        == Lari's version ==
FreeMarker vs. GSP for Dynamic Template Rendering

      * FreeMarker 1000 times completed in 5022ms.
      * GSP 1000 times completed in 2977ms.


        I won't release a new version of the plugin for now, because i want to
include a minor modification based in something that Daniel Dekany had
commented.


        The unofficial version (used in the tests) is here:
        Best regards,

                Daniel.



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





View message @ http://grails.1312388.n4.nabble.com/FreeMarker-vs-GSP-for-Dynamic-Template-Rendering-tp3213939p3220575.html

To unsubscribe from FreeMarker vs. GSP for Dynamic Template Rendering, click here.

Reply | Threaded
Open this post in threaded view
|

Re: FreeMarker vs. GSP for Dynamic Template Rendering

Lim Chee Kin
In reply to this post by marcopas
Hi there,

The benchmark application was updated and I re-run the test. Please see http://limcheekin.blogspot.com/2011/01/freemarker-vs-gsp-for-dynamic-template_27.html

Wish to hear from you soon!

Regards,
Chee Kin
Reply | Threaded
Open this post in threaded view
|

Re: FreeMarker vs. GSP for Dynamic Template Rendering

Dana
In reply to this post by Lari Hotari -
I apologize for replying to an old email. I have been using GroovyPagesTemplateEngine as a dynamic template engine in my application and I can comment on template caching. I store GSP's in the database, and although they can be edited at any time, they don't change for the most part. (If I started this project today, I would first try Lari's precompiled GSP reloading: GRAILS-5787)

There are many different signatures for GroovyPagesTemplateEngine.createTemplate(), and they all cache the template's GroovyPageMetaInfo in GroovyPagesTemplateEngine's pageCache. But only one method, createTemplate(Resource resource, boolean cacheable), tries to read from the pageCache. If the same dynamic template is to be rendered many times, then the Resource needs to be prepared in a special way or else the GroovyPageMetaInfo won't be found in the cache, and the GSP will be re-compiled and re-cached. If GroovyPagesTemplateEngine.clearPageCache() isn't then called periodically, the system will run out of memory (GRAILS-6571).

Before https://github.com/grails/grails-core/commit/50dea0be5f I had to make my own Resource implementation so that resource.getUrl().getPath() returned a usable key for the pageCache. With Grails 1.3.5, I think this code is enough to correctly cache and render a String as a GSP (untested):

class RenderTemplateService {
    GroovyPagesTemplateEngine groovyPagesTemplateEngine

    Writable renderTemplate(def myTemplate) {   
        def templateResource = new ByteArrayResource('my ${adjective} template'.getBytes('UTF-8'), "unique_template_identifier_${myTemplate.id}_${myTemplate.version}")
        def template = groovyPagesTemplateEngine.createTemplate(templateResource, true)
        return template.make([adjective: 'awesome'])
    }
}


I doubt this is the fastest or safest way to render dynamic templates, but it works well enough if you have a limited number of dynamic GSP's that you wish to render many times.

-Dana

On 1/12/11 9:10 AM, Lari Hotari wrote:

When you are using GSP in the view layer in an ordinary way, you don't have to separately cache or precompile GSPs. They are always precompiled by default in Grails 1.2.x and 1.3.x when a war file is generated.

--

For special uses cases where the GroovyPagesTemplateEngine is used as a "dynamic template" engine, the situation is different.

I personally haven't used GroovyPagesTemplateEngine directly in the Grails applications I have built.
I believe that when GroovyPagesTemplateEngine is used directly to compile&render "dynamic templates", you should keep a reference to the returned groovy.text.Template instance in some cache.

Could someone else explain (or contribute/point documentation about) how it should be used?

I remember that weceem & bean-fields are good examples of "dynamic templates" and the mail plugin is a example of GSP view rendering (outside of the web request). (Marc or Luke, could you share some experiences?)

There are 2 Jira issues open related to using GroovyPagesTemplateEngine directly:
http://jira.codehaus.org/browse/GRAILS-3818
http://jira.codehaus.org/browse/GRAILS-6809


Lari


12.01.2011 18:46, Arash Sharif wrote:

Have a link that describes how to cache the gsp...also does this mean pre compile like jsp or is it actual cache where if data changes the gsp does not know...

Many thanks

On Jan 12, 2011 8:34 AM, "Lari Hotari" <[hidden email]> wrote:
> 12.01.2011 15:38, Lim Chee Kin wrote:
>> Hi there,
>>
>> I perform some micro-benchmarking for the subject above.
>>
>> The result was surprising. FreeMarker is the winner. By perform rendering
>> 100 times for the same template, GSP need 119,946ms and FreeMarker need
>> approximately 1/4 of GSP, 32,749ms. Please see blog post at
>> http://limcheekin.blogspot.com/2011/01/freemarker-vs-gsp-for-dynamic-template.html
>> to find out more.
>>
>> Let's me know what you think! I welcome your input and feedback.
>>
>> Regards,
>> Chee Kin
>
> Freemarker is definitely faster than GSP for dynamic templates that
> aren't cached (what you tested). Compiling GSP each time is very slow.
>
> After modifying the test to cache templates, I get these results:
>
> * FreeMarker
> <http://localhost:8080/freemarker-vs-gsp/benchmark/index#>100
> times completed in 7500ms.
> * GSP <http://localhost:8080/freemarker-vs-gsp/benchmark/index#>100
> times completed in 1614ms.
>
>
> Here are the changes I made:
>
> def freemarker = {
> def out = new
> org.codehaus.groovy.grails.web.pages.FastStringWriter()
> def test1Instance = new Test1(prop2: "This is freemarker test")
> long startTime = System.currentTimeMillis()
> def t=new Template("freemarkerTemplate",
> new StringReader(freemarkerTemplateCode),
> freemarkerConfig.configuration)
> for (int i = 0; i < TIMES; i++) {
> t.process([test1Instance: test1Instance, flash:flash], out)
> out.flush()
> println "Executing... $i"
> }
> response.setContentType("text/json;charset=UTF-8")
> long timeTaken = System.currentTimeMillis() - startTime
> render '{"message":"' + TIMES + ' times completed in ' +
> timeTaken + 'ms."}'
> }
>
> def gsp = {
> def out = new
> org.codehaus.groovy.grails.web.pages.FastStringWriter()
> def test1Instance = new Test1(prop2: "This is gsp test")
> long startTime = System.currentTimeMillis()
> def t=groovyPagesTemplateEngine.createTemplate(gspTemplateCode,
> 'gspTemplate')
> for (int i = 0; i < TIMES; i++) {
> t.make([test1Instance: test1Instance]).writeTo(out)
> out.flush()
> println "Executing... $i"
> }
> response.setContentType("text/json;charset=UTF-8")
> long timeTaken = System.currentTimeMillis() - startTime
> render '{"message":"' + TIMES + ' times completed in ' +
> timeTaken + 'ms."}'
> }
> }
>
> Lari
>
Reply | Threaded
Open this post in threaded view
|

Re: FreeMarker vs. GSP for Dynamic Template Rendering

Daniel Henrique Alves Lima
In reply to this post by Lim Chee Kin
        Chee Kin, i've changed some configurations:

http://grails-freemarker-tags-plugin.googlecode.com/svn/doc/manual/guide/3.%20Miscellaneous.html#3.1.%20Configuration

        But i don't believe this will do any difference.

        After your first test you can also try:

        1. To re-run both tests, without tomcat restart;
        2. To run a lot more than 500 times (maybe 5000?) and to compare only
rendering times.


        Best regards,

                Daniel.

PS: I have no idea about what will happen. I'm just curious.

Lim Chee Kin wrote:
> Hi there,
>
> The benchmark application was updated and I re-run the test. Please see
> http://limcheekin.blogspot.com/2011/01/freemarker-vs-gsp-for-dynamic-template_27.html
>
> Wish to hear from you soon!
>
> Regards,
> Chee Kin


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: FreeMarker vs. GSP for Dynamic Template Rendering

Lim Chee Kin
Hi Daniel,

Thanks for information, I do aware about the update you done.

In fact, the updated benchmark application included your update at http://grails-freemarker-tags-plugin.googlecode.com/files/freemarker-vs-gsp.tar.bz2 and using freemarker-tags 0.5.8. Thanks for release new version of the plugin.

For item 2, I re-run the rendering tests 5,000 times as per your request, FreeMarker takes 177,624ms and GSP takes 142,105ms.

As I mentioned in my previous post, the requirements of form builder plugin need tackles both rendering and template creation, I will re-run the Both tests for 10,000 times in Tomcat 7.0.6 (It may take hours to run, I will leave my notebook on overnight) after Dana has workaround the OutOfMemoryError in GSP.

Best regards,
Chee Kin


On Fri, Jan 28, 2011 at 6:20 AM, Daniel Henrique Alves Lima [via Grails] <[hidden email]> wrote:
        Chee Kin, i've changed some configurations:
        But i don't believe this will do any difference.

        After your first test you can also try:

        1. To re-run both tests, without tomcat restart;
        2. To run a lot more than 500 times (maybe 5000?) and to compare only
rendering times.


        Best regards,

                Daniel.

PS: I have no idea about what will happen. I'm just curious.

Lim Chee Kin wrote:
> Hi there,
>
> The benchmark application was updated and I re-run the test. Please see
> http://limcheekin.blogspot.com/2011/01/freemarker-vs-gsp-for-dynamic-template_27.html
>
> Wish to hear from you soon!
>
> Regards,
> Chee Kin


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





If you reply to this email, your message will be added to the discussion below:
http://grails.1312388.n4.nabble.com/FreeMarker-vs-GSP-for-Dynamic-Template-Rendering-tp3213939p3243335.html
To unsubscribe from FreeMarker vs. GSP for Dynamic Template Rendering, click here.

Reply | Threaded
Open this post in threaded view
|

Re: FreeMarker vs. GSP for Dynamic Template Rendering

Daniel Henrique Alves Lima
Hi, Chee Kin.

Lim Chee Kin wrote:
> Hi Daniel,
>
> Thanks for information, I do aware about the update you done.

:-)

I'm afraid there is no defineFunctions configuration anymore. That's why
i've sent the following link:

http://grails-freemarker-tags-plugin.googlecode.com/svn/doc/manual/guide/3.%20Miscellaneous.html#3.1.%20Configuration


You are using defineFunctions for your test:

The Configuration
grails.plugins.freemarkertags = [
    autoImport: false,
    defineFunctions: true,
    asSharedVariables: true
]


But i don't believe that correct this will change any result (in regards
to performance).


If you re-run the tests without Tomcat restarting, you will see
improvement either in FreeMarker than in GSP.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: FreeMarker vs. GSP for Dynamic Template Rendering

Lim Chee Kin
Hi Daniel,

Thanks for reminder, I overlooked it. I agreed on what you said, if the defineFunctions no longer used by the plugin, leave it there will make no different for performance.

Thanks for further sharing.

Regards,
Chee Kin



On Fri, Jan 28, 2011 at 4:50 PM, Daniel Henrique Alves Lima [via Grails] <[hidden email]> wrote:
Hi, Chee Kin.

Lim Chee Kin wrote:
> Hi Daniel,
>
> Thanks for information, I do aware about the update you done.

:-)

I'm afraid there is no defineFunctions configuration anymore. That's why
i've sent the following link:
You are using defineFunctions for your test:

The Configuration
grails.plugins.freemarkertags = [
    autoImport: false,
    defineFunctions: true,
    asSharedVariables: true
]


But i don't believe that correct this will change any result (in regards
to performance).


If you re-run the tests without Tomcat restarting, you will see
improvement either in FreeMarker than in GSP.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





If you reply to this email, your message will be added to the discussion below:
http://grails.1312388.n4.nabble.com/FreeMarker-vs-GSP-for-Dynamic-Template-Rendering-tp3213939p3243975.html
To unsubscribe from FreeMarker vs. GSP for Dynamic Template Rendering, click here.

Reply | Threaded
Open this post in threaded view
|

Re: FreeMarker vs. GSP for Dynamic Template Rendering

Lim Chee Kin
In reply to this post by Daniel Henrique Alves Lima
Hi Daniel,

For your information, I am running Both (Template Creation and Rendering) 5,000 times in Tomcat 7.0.6, FreeMarker takes 174,828ms on first time, and I re-run the same test without restart the Tomcat, it takes 161,724ms. (I did tried to run the test 10,000 times, facing java.lang.OutOfMemoryError: Java heap space in iteration 5,442.)

Best regards,
Chee Kin

On Sat, Jan 29, 2011 at 12:08 AM, Chee Kin Lim <[hidden email]> wrote:
Hi Daniel,

Thanks for reminder, I overlooked it. I agreed on what you said, if the defineFunctions no longer used by the plugin, leave it there will make no different for performance.

Thanks for further sharing.

Regards,
Chee Kin




On Fri, Jan 28, 2011 at 4:50 PM, Daniel Henrique Alves Lima [via Grails] <[hidden email]> wrote:
Hi, Chee Kin.

Lim Chee Kin wrote:
> Hi Daniel,
>
> Thanks for information, I do aware about the update you done.

:-)

I'm afraid there is no defineFunctions configuration anymore. That's why
i've sent the following link:
You are using defineFunctions for your test:

The Configuration
grails.plugins.freemarkertags = [
    autoImport: false,
    defineFunctions: true,
    asSharedVariables: true
]


But i don't believe that correct this will change any result (in regards
to performance).


If you re-run the tests without Tomcat restarting, you will see
improvement either in FreeMarker than in GSP.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





If you reply to this email, your message will be added to the discussion below:
http://grails.1312388.n4.nabble.com/FreeMarker-vs-GSP-for-Dynamic-Template-Rendering-tp3213939p3243975.html
To unsubscribe from FreeMarker vs. GSP for Dynamic Template Rendering, click here.


12