Open gzip opened 11 years ago
It's easy to be fast when you don't actually implement the templating language :)
Compare:
To:
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.
I wrote another benchmark and got similar results:
Unfortunately, not all mustaches are created equal:
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.
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.
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.
Looking forward for more compares. Lightncandy seems very fast, but it doesn't support partials ..
@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.
Somewhere. I've changed computers once and wiped my computer twice since then, but I might be able to dig it up :)
@bobthecow How can I check spec compliance by self? Or where can I find these feature coverage tests? Because I don't need full mustache features and want to choose library that better fits my needs.
FWIW, I merged a PR into Handlebars.php that may address some of the spec compliance issues mentioned above.
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.