Re: [htmltmpl] Free Htmltemplate: Java implementation of HTML::Template
Brought to you by:
samtregar
From: <hn...@xe...> - 2004-02-18 21:05:08
|
Sam Tregar <sa...@tr...> writes: > On Wed, 18 Feb 2004, Hrvoje Niksic wrote: > >> Allow me to announce the availability of a Java implementation of >> HTML::Template. The home page is at: >> >> http://htmltemplate.inet.hr/ > > Wow, great work! I love the website and your excellent > documentation. Thanks! > I do, however, have a bone to pick. You claim your system is much > faster than HTML::Template and HTML::Template::JIT: > > Free htmltemplate is significantly faster than HTML::Template in > rendering pre-compiled templates. Even with the JIT in place, > which according to Sam speeds up template rendering by a factor > of 4 to 8, htmltemplate might still be as fast or faster. > > Can you back this up with numbers? Good point, I really should back up such a claim with numbers. I originally didn't go out of my way to make Htmltemplate very fast, I simply coded it the "obvious" way. But then I did some benchmarks and, to my surprise, found it to be a good deal faster than I expected. The benchmark was admittedly *very* simple-minded: take a template, compile it once, and run the template transformation over and over to see how many transformations per second I can squeeze. The result was astounding 3000 renderings per second, which was totally beyond my expectations. I first thought that I did something wrong, that the code wasn't even running, but adding the output showed that I was indeed producing the intended output 3000 times in a row in about 1 second. If my memory serves me, the same kind of benchmark showed HTML::Template performing about 300 renderings per second. The reasoning that follows is summed up by the above paragraph: if JIT speeds up HTML::Template 8 times, Htmltemplate might still be faster. But I really haven't checked it. I guess I should reword that paragraph to make it clear that it's based on speculation and not on actual measurements of HTML::Template::JIT's performance. > Java has improved a great deal, granted, but I'd be pretty shocked > if it could beat the highly-optimized C code generated by > HTML::Template::JIT. The code generated by HTML::Template::JIT still contains calls to Perl's library and object system, doesn't it? To me that's quite different from typical hand-written C code, which I'd expect to always beat Java by a wide margin. How do you benchmark HTML::Template::JIT? I can try to repeat the same benchmark with Free Htmltemplate to see if I still get the speedup I got when I last compared them. |