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

I'd like to see your tests. It's hard to see how your perl one could be faster, unless it is leaving out significant pieces of functionality.

Replies are listed 'Best First'.
Re^4: developing a template system
by tinita (Parson) on Aug 13, 2005 at 10:05 UTC
    ok, the test script is right there in the package (t/test.pl, t/test.html). I updated some minutes ago it because the version that was in the package wasn't runnable.
    ok, it's not a complete test of all functionalities, but you can have a look at it and maybe tell me what I'm missing.

    update: i updated the test.pl script again, so now everybody should see quickly what it is doing. before it was just a big mess...

    update2: here is the test script with additional testing of H::T::JIT: http://www.tinita.de/projects/perl/modules/HTC_test_pl.txt
    when I run it HTC is more than 3 times faster than H::T::JIT, so I *must* be doing something wrong...

      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.

        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.