Justin Wells wrote:
> Quoting Dave Glowacki ([EMAIL PROTECTED]):
> > I then did some benchmarking and found that FreeMarker is
> > at a minimum 5 times faster than WebMacro for their common
> > operations.  This seems to be due to all the introspection
> > that WebMacro must perform.
>
> I doubt it's the introspection, since that's only done the first time
> you access an object. WM's performance would be theoretically the same
> as JSP's. I haven't optimized it yet, since nobody has ever had a
> performance problem.
>
> My guess is you misconfigured your WebMacro. The defaults it ships with
> has the template cache disabled in the WebMacro.properties file--turning
> on the cache speeds WM up a factor of 10-20.
>
> With the cache off, it reparses every template on every request.

You're right, I didn't have caching turned on in either WebMacro
or FreeMarker, and I was indeed wrong in my statement that FreeMarker
is 5 times faster than WebMacro.

I had trashed my benchmarks, so I spent a couple of hours today
rebuilding them to recheck everything.

For each package, I wrote as identical as possible versions of 4 servlets:
 * a regular servlet which didn't call the template package (as a control)
 * a small HTML-only template (no embedded operators)
 * a big HTML-only page (the javax.servlet javadoc index page)
 * a template which did some processing on each element of a list
   before printing it.

The benchmark creates the package-specific version of each template,
calls init() on it and runs it once (to get any page-loading or JIT
stuff out of the way) then takes turns running each servlet for the
specified number of repetitions and totals the time of those reps.
The servlets write to a StringWriter, so there shouldn't be any  I/O
overhead.

I ran this code for 5000 reps under JDK 1.1.6 on Solaris/sparc,
JDK 1.3beta on Solaris/ultrasparc, JDK 1.1.7B on Linux/x86 and
JDK 1.1.8 on FreeBSD.

Results (in total milliseconds for 5000 runs of each servlet) were:

                NonTmpl         SmallPage       BigPage         ListProcess
                FM      WM      FM      WM      FM      WM      FM      WM
Solaris/1.1.6     1540    1511    6536    8902  119603  194510  113875  172333
Linux/1.1.7B       646     324    1293    4303   80737  135410   40428   70637
FreeBSD/1.1.8     2783    2795    7955   12604  151277  188484  217431  343071
Solaris/1.3beta    700     668   11798    1797   23010   41795   54077  138732

Or, a bit more readably, how fast the FreeMarker servlet finished compared
to WebMacro's time:

                NonTmpl         SmallPage       BigPage         ListProcess
Solaris/1.1.6   102%             73%             61%            66%
Linux/1.1.7B    200%             30%             60%            57%
FreeBSD/1.1.8    99%             63%             80%            63%
Solaris/1.3beta 105%            657%             55%            39%

These number obviously aren't exact, but they sure seem to indicate
that FreeMarker pretty consistently takes roughly 2/3rds of the time
needed by WebMacro (I'd love to know what's up with the SmallPage stuff
on 1.3beta, though)

If you'd like to run this all yourself, I packaged it up and stuck it at
http://brutus.ssec.wisc.edu/~dglo/tmpl-bench/

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to