Extract the Freemarker tag templates; Freemarker
doesn't cache them when they're loaded from the
classpath.

http://struts.apache.org/2.x/docs/performance-tuning.html

d.

--- Jeromy Evans <[EMAIL PROTECTED]>
wrote:

> Jordi Rubio Moreno wrote:
>  >  Is JSP taglib too slow and not recommended
> solution for production 
> portals?
> 
> Hi Jordi, I'm impressed you made the effort to
> compare Freemarker vs Jsp 
> performance.  I've re-posted your question at the
> top of this email in 
> the hope that it gains the attention of some of the
> more experienced 
> developers.
> 
> In your test did you ensure your comparison doesn't
> include the first 
> time the JSP is retrieved?  On the first request the
> JSP is converted to 
> java and then compiled which is inevitably slow. 
> Subsequent requests 
> execute the bytecode and are much faster. Did you
> take this into account?
> 
> Within struts2, I think it would be a fair
> assumption that JSP will 
> always be somewhat slower than pure Freemaker
> because the UIBeans are 
> rendering using the Freemarker template engine
> anyway.  I wouldn't have 
> imagined it would be <10% slower but have no
> evidence.  I'll try to run 
> the same comparison if I get a spare moment.
> 
> Anyone else care to comment?
> 
> Jordi Rubio Moreno wrote:
> > Hi Jeromy,
> >
> > I apologize to respond this email so late.
> >
> > I've develop a little test portal (close in
> functionality to production portal), and I've notice
> that JSP taglib are slower that Freemarker
> equivalent page (I'm speaking about a JSP result
> page rendered in 1.2s and the same page rendered
> with freemarker in 600ms).
> >
> > It's certain that there are a lot of JSP taglib
> documentation and S2 forums, but in a production
> site it's critical an excellent time response.
> >
> > I don't know if I'm doing anything wrong... I show
> you a little fragment of test code in JSP taglibs an
> Freemarker:
> >
> > ***************** JSP taglibs
> **********************
> >
> >     <s:iterator value="offers">
> >             <tr>
> >                     <td>
> >                             <s:url id="curUrl" action="Redirect"
> includeParams="none">
> >                                     <s:param name="url"><s:property
> value="offUrl"/></s:param>
> >                             </s:url>
> >                             <a href="${curUrl}"><s:property
> value="offTitle"/></a><br>
> >                             <s:if test="%{offCompany != null}">
> >                                     <b><s:text
> name="Results.company"/></b>:&nbsp;<s:property
> value="offCompany"/><br>
> >                             </s:if>
> >                             <s:if test="%{offSalary != null}">
> >                                     <b><s:text
> name="Results.salary"/></b>:&nbsp;<s:property
> value="offSalary"/><br>
> >                             </s:if>
> >                             <s:property value="offDescr"/><br>
> >                             <s:url id="addToShortListUrl"
> action="ShortList!add" includeParams="none">
> >                                     <s:param name="offId"><s:property
> value="offId"/></s:param>
> >                             </s:url>
> >                             <a href="${addToShortListUrl}"><s:text
> name="Results.addToShortList"/></a><br><br>
> >                     </td>
> >             </tr>
> >     </s:iterator>
> >
> > ******************** FREMARKER
> ************************
> >
> >
> >     <#list offers as o>
> >             <tr>
> >                     <td>
> >                             <@s.url id="curUrl" action="Redirect"
> includeParams="none" url="${o.offUrl}" />
> >                             <a href="${curUrl}">${o.offTitle}</a><br>
> >                             <#if o.offCompany != "">
> >                                     <b><@s.text
>
name="Results.company"/></b>:&nbsp;${o.offCompany}<br>
> >                             </#if>
> >                             <#if o.offSalary != "">
> >                                     <b><@s.text
> name="Results.salary"/></b>:&nbsp;${o.offSalary}<br>
> >                             </#if>
> >                             ${o.offDescr}<br>
> >                             <@s.url id="addToShortListUrl"
> action="ShortList!add" includeParams="none"
> offId="${o.offId}" />
> >                             <a href="${addToShortListUrl}"><@s.text
> name="Results.addToShortList"/></a><br><br>
> >                     </td>
> >             </tr>
> >     </#list>
> >
> >
> > Is JSP taglib an slow and not recommended solution
> for production portals?
> >
> > Thanks a lot for your patience :)
> >
> > Best regards!
> >
> > Jordi Rubio Moreno
> >  
> >
> >
> > -----Mensaje original-----
> > De: Jeromy Evans
> [mailto:[EMAIL PROTECTED] 
> > Enviado el: sábado, 19 de mayo de 2007 6:13
> > Para: Struts Users Mailing List
> > Asunto: Re: [S2] Freemarker vs struts taglibs
> >
> >
> > If you're a new user of Struts2 and JSP then I
> suggest you simply start with JSP as there's far
> more resources and tutorials available.
> > You only must become aware of Freemarker once you
> wish to extend the default themes.
> >
> > Within Struts2, by default Freemarker templates
> are used when rendering the UI components (ie. the
> S2 taglib classes that extend AbstractUITag such as
> TextField).
> > eg. if you use the <s:textfield> tag, Struts2 will
> render it using the text.ftl template for the
> specified/current theme.
> >
> > Eventually you may wish to extend the theme
> (change with the way <s:textfield> is rendered) at
> which time you'll probably create your own templates
> for the UI components-of-interested and start using
> Freemarker.
> >
> > Eventually may you also wish to create your own
> taglib UI components following the the S2
> conventions in which case you'd follow the same
> template approach (but Struts2 does not preclude you
> from using any other JSP/taglib convention).
> >
> > As mentioned in previous responses and the link
> below, Struts2 allows you to use entire Freemarker
> page results instead of JSP.  There are good
> technical arguments for using Freemarker instead of
> JSP, but generally speaking right now you'll find
> more people to help, initially less effort, more
> jobs and better IDE-support with JSP and almost
> everything you learn with JSP can be later be
> applied within the Freemarker context.
> >
> >   
> >> On 5/17/07, Musachy Barroso <[EMAIL PROTECTED]>
> wrote:
> >>     
> >>> FreeMarker is a template engine, with it's own
> syntax. JSP tags can 
> >>> be used in FreeMarker, adding some
> configuration. In the case of 
> >>> Struts tags, no configuration is required, and
> you can use them like 
> >>> you would in JSP except a few differences, see
> this for details:
> >>>
> >>>
> http://struts.apache.org/2.x/docs/freemarker.html
> >>>
> >>> musachy
> >>>
> >>> On 5/17/07, Jordi Rubio Moreno
> <[EMAIL PROTECTED]> wrote:
> >>>       
> >>>> Hi,
> >>>>
> >>>> I'm a bit confused. I need to decide if I'll
> use Freemarker or 
> >>>> Struts taglibs, and I don't know the
> differences between both. E.g. 
> >>>> what's
> 
=== message truncated ===



 
____________________________________________________________________________________
No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to