in reply to Re^4: developing a template system
in thread developing a template system

I finally had a chance to test this myself. On my system, H::T::C is about 2.5 times faster than H::T::JIT, which is about 6 times faster than normal H::T. That's an impressive result. I did notice though that the output is not identical. It looks like your loop context vars are off by 1, and maybe some interpolation is not quite the same.

I wonder if any of the speed difference is a result of feature differences. As you mentioned, they are not identical in features. Regardless, I think this shows that compiling to perl opcodes is a good approach and that either Inline::C is just not fast enough or the C code generated by H::T::JIT could be optimized more.

Replies are listed 'Best First'.
Re^6: developing a template system
by tinita (Parson) on Aug 22, 2005 at 09:00 UTC
    It looks like your loop context vars are off by 1
    yep, noticed that, that should be an easy fix.

    About speed - I tested with a larger template by just repeating the same template code a couple of times. The larger the template, the faster was H::T::JIT.
    With my example template, they reach about the same speed here. So for big templates H::T::JIT definitely seems to be a lot faster.

    If I turn off case_sensitive, I'm only about 2.5 times faster than H::T instead of 5, but on the other hand turning on case_sensitive in H::T doesn't result in a speed gain.

      My results are a bit different. When I turn off case-sensitivity, JIT immediately becomes 20% faster than Compiled. When I increase the size of the template, JIT slows down but Compiled is almost unaffected. At 4 times the original size, JIT slows down to the point where Compiled is twice as fast as JIT.

      FYI, my system is Fedora Core 3 with Perl 5.8.5.

        interesting - i guess i'll extend the benchmark script a bit so that it runs for different template sizes. The results seem to differ very much. How are you testing?

        I'm on Linux 2.6.10-5-amd64-xeon, perl 5.8.4.