Thanks Dick!

After adding the following to my test JSP:
java.beans.PropertyEditorManager.registerEditor(String.class, 
sun.beans.editors.StringEditor.class);

I got a significant boost in performance but its still a little slow.  

1) <ui:select> tag
Execution Time=4.253 sec

2) <ui:iterator> with <ui:property> tag
Execution Time=0.449 sec

3) JSP scriptlet using WW API
Execution Time=0.0020 sec

At this point I'm thinking of just implementing it as an include as a JSP scriplet 
using the WW API for the country list.  

Any other ideas (other than caching)?  If I've exposed a bottleneck in the WW UI tags 
then I'd like to help to fix it.

Thanks,
Kirk Rasmussen
Lucasfilm Ltd.

> -----Original Message-----
> From: Dick Zetterberg [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 13, 2003 1:59 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [OS-webwork] Slow performance using ww:iterator tag
> (version 1.2.1)?
> 
> 
> Hi Kirk,
> 
> I do not use the ui: tags myself (I stick with property and 
> iterator etc),
> so I cannot say for sure, but I believe the bad performance 
> is due to the
> use of PropertyEditors when printing the select list.
> 
> I had similar performance problems with the 1.2.1 version. The 1.3RC1
> version does not have this performance problem because there 
> one introduced
> a cache of the PropertyEditors. Unfortunately that is not 
> allowed since it
> is not thread-safe at all (as have been discussed on the list).
> Last week I posted a patch to the list (and Jira), that would 
> fix this for
> 1.3, but I still have not heard of any committer adding it to CVS.
> 
> Anyway, back to your problem. What you can try is to patch 
> the BeanUtil
> class. Change the method:
> String toStringValue(Object obj) to just do a:
> if (obj == null) return ""; else return obj.toString();
> However, then you cannot rely on any PropertyEditor to be used for
> displaying your data. I do not know how important that is for 
> you. Or you
> could change it to:
> if (obj == null) return""; else if (obj instanceof String) 
> return (String)
> obj; else  (.... do the method as it is today...).
> 
> When I first had these performance problems I noticed that when the
> PropertyEditorManager should return an editor for a String it 
> took even
> longer that normal! It seemed as if this was because the 
> StringEditor was
> not registered in the HashMap in the PropertyEditorManager, 
> so it was not
> found on the first lookup, but later when the manager checks 
> for different
> classnames etc.
> So if you do not want to do the changes to Webwork code I 
> described above,
> you can try to add a String editor to the PropertyEditorManager like:
> PropertyEditorManager.registerEditor(String.class,
> sun.beans.editors.StringEditor.class);
> That might improve your performance a bit.
> 
> Hope this helps! Good luck!
> 
> Best regards,
> 
> Dick Zetterberg
> 
> [EMAIL PROTECTED]
> 
> Original Message -----
> From: "Kirk Rasmussen" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, January 12, 2003 2:38 AM
> Subject: [OS-webwork] Slow performance using ww:iterator tag (version
> 1.2.1)?
> 
> 
> > Happy new year everyone!  I have a simple question about the
> <webwork:iterator> tag and performance using WW 1.2.1.
> >
> > I have this list of countries that contains 245 entries.  
> When I execute
> the following fragment, it takes about 15 seconds to execute 
> the iterator
> loop by itself.  Any of you WW gurus have some pointers on 
> making it faster?
> I can't simply cache the select list because the form is for 
> an address book
> so the selected value is user specific.
> >
> > <%@ taglib uri="webwork" prefix="ww" %>
> > <%@ taglib uri="webwork" prefix="ui" %>
> > <%
> >     long start, end = -1;
> > %>
> >
> >     <table width="100%">
> >     <tr>
> >     <!-- start cell with webwork components -->
> >     <ww:action name="'CountriesList'" id="countrieslist"/>
> > <% start = System.currentTimeMillis(); %>
> >     <ui:select label="'Country'" name="'country'"
> list="@countrieslist/countries" listKey="'countryCode'"
> listValue="'description'"/>
> > <% end = System.currentTimeMillis(); %>
> >     <!-- end cell with webwork components -->
> >     </tr>
> >     </table>
> > <p>
> > Execution Time=<%= ((double)end - start) / 1000.0 %> sec
> > </p>
> >
> > Thanks,
> > Kirk Rasmussen
> > Lucasfilm Ltd.
> >
> >
> > -------------------------------------------------------
> > This SF.NET email is sponsored by:
> > SourceForge Enterprise Edition + IBM + LinuxWorld
> http://www.vasoftware.com
> > _______________________________________________
> > Opensymphony-webwork mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 
> 
> 
> -------------------------------------------------------
> This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
> are you planning your Web Server Security? Click here to get a FREE
> Thawte SSL guide and find the answers to all your  SSL 
> security issues.
> http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
> _______________________________________________
> Opensymphony-webwork mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 

Attachment: countries-test.jsp
Description: countries-test.jsp

Reply via email to