tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luca Passani <>
Subject Optimizing tag-lib performance
Date Sat, 23 Jul 2005 15:18:57 GMT
Hello again,

I would like to improve the performance of a tag-lib I have created.
Some obvious optimizations would be to turn things like:
 out.print(" href=\""+href+"\"");
 //title is optional
 if (!title.equals("")) {
        out.print(" title=\""+title+"\"");                
into (is this what they call "string internalization"?):
final static String HREF_ATT = " href=\"";
final static String TITLE_ATT = " title=\"";
 StringBuffer sb = new StringBuffer();

Before I start applying these changes, though, I would like to be able 
to sort of measure the improvements.
I tried something as basic as:

 long startTime = System.currentTimeMillis();

%><%@ taglib uri="/WEB-INF/tld/wall.tld" prefix="wall" 
%><wall:document><wall:xmlpidtd />
 <wall:menu colorize="true" autonumber="true">
   <wall:a href="http://url1" title="Games">Games</wall:a>
   <wall:a href="http://url2" title="Horos">Horoscopes</wall:a>
   <wall:a href="http://url1" title="Kids">Kids</wall:a>
   <wall:a href="http://url2" 
   <wall:a href="http://url1" title="Music">Music</wall:a>
   <wall:a href="http://url2" title="Radio">Radio</wall:a>
   <wall:a href="http://url2" title="TV">TV</wall:a>
 long stopTime = System.currentTimeMillis();
 long elapsedTime = stopTime - startTime;

the problem is that when I reload the page,  the number of milliseconds 
is zero and occasionally 8,9 or 10
(I see output in the tomcat console running on my laptop, so I am sure 
that the browser is not caching).


- is there something I am getting basically wrong?
- is my tag-lib optimized enough that I don't need to care about further 
optimization? possibly
  because the compiler/JVM already did the optimization for me?
- are there better ways/tools to measure tag-lib performance?



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message