I've seen the same reports of issues with performance and many Struts tags
on a page, and I believe this is a container issue, not an inherent problem
with tags. I'm a heavy user of Struts, and I have some pages with many
hundreds of tags. (Enough that I've hit the JVM method size limit more than
once.) A large number of those tags are <bean:message>, as you might expect,
but there's a bunch of <logic:iterate> and just about everything else.

I use Resin as my container, and it *screams*, even on those huge tag-heavy
pages. Resin 2.0.x takes full advantage of the JSP 1.2 spec with regard to
reusing tag handlers, which is probably one reason, but even Resin 1.2.x was
very fast, and it doesn't reuse tag handlers at all.

--
Martin Cooper


----- Original Message -----
From: "Burr Sutter" <[EMAIL PROTECTED]>
To: "Tag Libraries Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, February 27, 2002 8:41 AM
Subject: Re: Will Using Tagged Libraries Affect Performance


> Many folks have reported issues with the Struts custom tags. Specifically
in
> the areas of internationalizing every on screen piece of text as well as
> long select lists where the contents are dynamically generated via a
custom
> tag.  The alternative is to hard-code the mult-lingual translations into
> different JSPs or go with XML+XSL (which is also slower by comparison).
And
> hard-code the list-box choices as HTML.
>
> In the case of Struts the entire page is built with custom tags. Virtually
> no basic HTML in the page therefore it is slower than the comparable JSP.
>
> So, I was comparing custom tags to HTML tags not scriplets. Most new
custom
> tag developers seem to make that comparison for some reason. Obviously you
> get a lot more functionality (dynamic instead of static) but some folks
> forget about that, just complain about speed.
>
> Burr
>
> ----- Original Message -----
> From: "Shawn Bayern" <[EMAIL PROTECTED]>
> To: "Tag Libraries Users List" <[EMAIL PROTECTED]>
> Sent: Wednesday, February 27, 2002 11:22 AM
> Subject: Re: Will Using Tagged Libraries Affect Performance
>
>
> > On Wed, 27 Feb 2002, Burr Sutter wrote:
> >
> > > I think it could have a negative impact on performance.  Why? Many
> > > servlet containers will instantiate and then throw away the tag
> > > handler class with each use on the page. So, if a tag handler requires
> > > lots of setup (e.g. connect to a database, issue a query, check some
> > > session or request attributes) then it could add significant time to
> > > the loading of a page.
> >
> > Right.  Since instantiation itself is considerably cheaper than most
> > developers expect, though, a properly written tag handler can get around
> > these issues.  For instance, connection pooling in general is recognized
> > as a useful methodology; a tag handler's constructor shouldn't
ordinarily
> > need to open a database connection from scratch.
> >
> > In general, tags (by themselves) shouldn't have a substantial effect on
> > performance.  The only thing that a simple tag adds, in comparison to a
> > corresponding scriptlet, is a few function invocations; in a proper JIT,
> > these ought to be extremely cheap.  (BodyTag implementations do require
> > the container to buffer body content, which can have a performance cost,
> > especially if the body content is extremely large.)
> >
> > But assuming that the operations are like those you list ("connect to a
> > database, issue a query, check some session or request attribute"), the
> > difference between doing this in a scriplet and doing it in a tag should
> > be relatively minor.  How minor?  As a ballpark figure, using the
> > Benchmark Taglib on my Linux server at home, I don't notice any
> > significant difference between constructs like
> >
> >   <benchmark:duration>
> >     <% for (int i = 0; i < 10000; i++) { %>
> >       <% if (Math.random() < 0.5) { %>foo<% } %>
> >     <% } %>
> >   </benchmark:duration>
> >
> > and
> >
> >   <benchmark:duration>
> >     <% for (int i = 0; i < 10000; i++) { %>
> >       <c_rt:if test="<%= Math.random() < 0.5 %>">foo</c_rt:if>
> >     <% } %>
> >   </benchmark:duration>
> >
> > Even the optimizations that some containers make, pooling tag handlers,
> > probably won't be particularly noticeable except in extremely tight
loops
> > (like "do this 10000 times") when tag handlers are written properly.
> >
> > --
> > Shawn Bayern
> > Author, "JSP Standard Tag Library"  http://www.jstlbook.com
> > (coming this spring from Manning Publications)
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to