Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

lightncandy performance #133

Open
gzip opened this Issue · 9 comments

4 participants

Gamaiel Zavala Justin Hileman Rafael Bodill Thomas Lovett
Gamaiel Zavala

Not an issue per se but I wonder if you can comment on this:
https://github.com/zordius/HandlebarsTest#quick-conclusion

It looks like mustache.php is supporting more features in the compiled templates like context resolution and strings vs methods, so it's not really apples to apples. Just wanted your take on it.

Justin Hileman
Owner

It's easy to be fast when you don't actually implement the templating language :)

Compare:

To:

Justin Hileman
Owner

Okay. I got the benchmark running locally, and to be fair, it's not as bad as it initially looked. Apparently they've improved their library a bit, so it doesn't just forget to render quite as many bits now.

Justin Hileman
Owner

I wrote another benchmark and got similar results:

bench

Unfortunately, not all mustaches are created equal:

spec

The black squares are specs that hit a fatal error: i.e. PHP just died. The red ones are exceptions: nothing was rendered at all. The striped red blocks returned a result, but did not match the expected output.

Note that these benchmarks and tests were against the official Mustache spec, which is a collection of small templates and data. I'm planning to add some larger benchmarks too see how performance changes when confronted with a more complex template, but based on the HandlebarsTest above, I'd say they'll probably be pretty comparable.

Gamaiel Zavala

This looks like a very telling comparison. There are some discernible patterns amongst the libs. It would be interesting to see which parts of the spec generate the errors; fatal, empty, or otherwise. Looking forward to further information.

Justin Hileman
Owner

Yep. I'll definitely be releasing this once I have a chance to make it more presentable :)

The right half of the top row is delimiter changes. The end of the third row, start of the fourth is partials. I believe mustache-php does not implement them, but tries to throw an exception class that does not exist (hence the fatal error). Handlebars works just fine, but it isn't quite spec compliant (hence the red stripes). I'd guess that one's due to whitespace. And I haven't looked into phly_mustache to know why it's hitting a fatal error.

Rafael Bodill

Looking forward for more compares. Lightncandy seems very fast, but it doesn't support partials ..

Thomas Lovett

@bobthecow Do you still have the code, etc. for your benchmarks and spec compliance tests? I'm interested to see how all the frameworks compare now.

Justin Hileman
Owner

Somewhere. I've changed computers once and wiped my computer twice since then, but I might be able to dig it up :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.