tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Burton <bur...@rojo.com>
Subject Jasper generating garbage? new String() in generated code?
Date Sun, 29 May 2005 00:31:17 GMT
This is another smaller issue.

>
> <c:set var="foo" value="bar"/> 

yields:

> _jspx_th_c_set_0.setValue(new String("bar"));

If this is a constant string why does it need to continually call new 
String("bar") here?

This is just going to waste CPU and cause more garbage to be generated 
which the GC will eventually have to reclaim (slowing down page throughput).

Of course  it could be claimed that modern VMs would optimize this away 
but I just did a quick benchmark and using a constant string was 3x 
faster... This included GC time.

So all and all it might yield to faster JSP time for pages that uses 
static strings in JSP vars.

Kevin

-- 


Use Rojo (RSS/Atom aggregator)! - visit http://rojo.com. 
See irc.freenode.net #rojo if you want to chat.

Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html

   Kevin A. Burton, Location - San Francisco, CA
      AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message