3 ms·
> Thirty times faster than Handlebars This is versus the rust implementation of Handlebars. I'm not sure what the internals of that look like (whether it compl
by pitaj 8y ago
> Thirty times faster than Handlebars
This is versus the rust implementation of Handlebars. I'm not sure what the internals of that look like (whether it complies templates to native code or what).
I do know that the JS version compiles templates directly into string concatenation, so I wonder how Zapper running as wasm compares to rendering a compiled handlebars template.
- coder543 8y agoI would enjoy seeing that comparison too, but I have been too busy lately to put time into more comparisons. If someone can show that the Rust implementation of handlebars is slower than the JavaScript one, that would be really fun and interesting to see on its own! I would imagine the Rust one is reasonably efficient, but HashMaps are tremendously slower than the fixed enums my code is generating at Rust compile time, and the Rust Handlebars implementation uses HashMaps extensively for substitutions.
- nicoburns 8y agoI did a whole bunch of benchmarking of template engines, and even went as far as to write my own a few tears ago when mobile devices were slow and I was trying to eke out extra performance. Turns out the bottleneck is almost never interpolating the template, it's the browser parsing/creating the resultant DOM. This is true with both the innerHTML and createElement approaches to constructing the DOM.
- coder543 8y agoThis is true for client-side rendering of templates, but not necessarily true for server-side template rendering.