jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Bayern <bay...@essentially.net>
Subject [PROPOSAL] Simple benchmarking taglib
Date Sat, 07 Apr 2001 09:30:50 GMT
In dicussions about how best to design tag libraries, issues of
performance sometimes arise.  I figured a simple 'benchmark' tag library
would aid performance testing of other tag libraries, so I wrote up a
relatively simple one.

Here's the interface.  I'm not a benchmarking expert, so there are likely
other features that could be added.

    <benchmark:duration> ... </benchmark:duration>

	Calculates and prints the number of milliseconds taken (in
	elapsed, "clock" time) to calculate its body.  The number is
	printed after the body.  As a hack, this tag can be enclosed by
	<datetime:format> with an appropriate formatting string (i.e.,
	just referring to hours, minutes, and seconds) to print out a
	reasonably readable duration.


	repeat (optional)	number of repetitions (default: 1)
	output (optional)	if "true," the tag's body is output
				(by default, it is hidden)

    <benchmark:exclude> ... </benchmark:exclude>

	Excludes its body from the overall benchmarking test.  Some small
	amount of time is necessary to process these tags
	themselves, so they are not completely transparent.  Nonetheless,
	they may be useful for integrated timing of a subset of a compound

	<benchmark:exclude> effectively "pauses" the timer of its nearest
	ancestor <benchmark:duration> tag while it runs.

Example uses:

    <%-- Typically returns between 1000 - 1010 on my system. --%>
        <% Thread.sleep(1000); %>

    <%-- Typically returns about 1010 on my system. --%>
        <% Thread.sleep(1000); %>
            <% Thread.sleep(1000); %>

This isn't meant as a full-strength benchmarking package.  It's just a
simple way to get rough performance data if you want to sketch the
performance of certain tags, tag combinations, or arbitrary JSP fragments.

Feel free to test the code at


Assuming there are no objections, I'll call a vote in a few days, once
I've gotten comments (or haven't, as the case may be).



View raw message