tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Burton <>
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"/> 


> _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.



Use Rojo (RSS/Atom aggregator)! - visit 
See #rojo if you want to chat.

Rojo is Hiring! -

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

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

View raw message