Hi Jeromy, > > 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. Thanks a lot! :) I hope this thread can open a sane discussion about performance, ticks and tips > 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? That's correct. I have compared both scenarios without considering the first JSP access (I know how JSP works at this level). Thanks again for your time :) Cheers Jordi Rubio Moreno -----Mensaje original----- De: Jeromy Evans [mailto:[EMAIL PROTECTED] Enviado el: lunes, 28 de mayo de 2007 14:37 Para: Struts Users Mailing List Asunto: Re: [S2] Freemarker vs struts taglibs 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>: <s:property value="offCompany"/><br> > </s:if> > <s:if test="%{offSalary != null}"> > <b><s:text > name="Results.salary"/></b>: <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>: ${o.offCompany}<br> > </#if> > <#if o.offSalary != ""> > <b><@s.text > name="Results.salary"/></b>: ${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 >>>> >>> the >>> >>>> difference between <s:iterator> and <@s.iterator>, <s:url> and >>>> >>> <@s.url>, >>> >>>> etc etc... >>>> >>>> I have seen all the tutorials and examples I have found working >>>> with taglibs, but people says WebWork and Struts 2's choice is >>>> >>> Freemarker... >>> >>>> Please, help me to understand why taglibs or Freemarker :) >>>> >>>> Thanks a lot! >>>> >>>> Cheers! >>>> >>>> >>> >>> -- >>> "Hey you! Would you help me to carry the stone?" Pink Floyd >>> >>> >> --------------------------------------------------------------------- >> - >> -- >> >> No virus found in this incoming message. >> Checked by AVG Free Edition. >> Version: 7.5.467 / Virus Database: 269.7.4/811 - Release Date: >> 18/05/2007 3:50 PM >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]