This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes Do tags have an object creation overhead? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Do tags have an object creation overhead?" Watch "Do tags have an object creation overhead?" New topic
Author

Do tags have an object creation overhead?

Alok Pota
Ranch Hand

Joined: Mar 07, 2001
Posts: 185
Is there an object creation overhead associated with JSP tags?
More specifically...
Are JSP tags *created* for every request that comes along?
Do App Servers typically use some caching mechanism t reduce the number of tags? Or is there any optimization done at all for
JSP tags?
-Alok
Scott Stirling
Greenhorn

Joined: Mar 05, 2001
Posts: 24
Depends on the app server. Tag caching and pooling is going to be a new thing in JRun 3.1, which is coming out in beta 1 soon (next week). I don't know how Tomcat and others handle it.
I predict by the end of the year everyone will support efficient tag reuse and pooling, but there were a lot of disagreements about how to do it on the JSP spec group during the 1.2 specification development. How you do it largely depends on when release() is called on a tag handler and what that should do, and this was a matter of contention among various vendors and experts involved in the spec.
Take a look at the generated Servlet code to see how your JSP tags are handled on the back end. Also note that with the modern, optimizing-JIT JVMs (especially HotSpot and Sun & IBM 1.3 JVMs), object creation and deletion for short-lived objects is cheap, and pooling can actually interfere with the optimizing JVM's management of allocation and garbage collection.
------------------
Scott Stirling
Author of Java Server Pages Application Development
[This message has been edited by Scott Stirling (edited March 07, 2001).]


Scott Stirling<BR>Author of <A HREF="http://www.amazon.com/exec/obidos/ASIN/067231939X/ref=ase_electricporkchop/107-2476442-4883722" TARGET=_blank rel="nofollow">Java Server Pages Application Development</A>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Do tags have an object creation overhead?