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]>

Reply via email to