Zapper: A Very Fast Templating Engine
ceres1.space
ceres1.space
On the demo page, you might consider dropping the number of rows by default from 10,000 to 1,000. Though Zapper's rendering handles it very quickly, the browser struggles a bit to keep up in Chrome and FF. It gives a pretty snappy experience doing live-typing editing at 1,000 though.
The Spectre attack mitigations mean that browsers only provide 2ms to 3ms resolution on their JavaScript/WASM timers now, which makes the measurement accuracy very rough in WASM unless the operation being measured takes a few tens of milliseconds.
Is it possible to do a partial (?), that is the concat'ed result of a foreach and then inject (?) that result (string) into the parent view (?)?
If this can he done securely then it seems to me your two limitations are not only solved, but force a better sense of structure on building with your tool.
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.
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.
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.
john doe 35 15134 BOB 7 6956.05kg
john ... truncated to 500,000 characters to keep browser from becoming sluggish.
The "truncated to 500,000 characters..." probably helps a bunch for the browser.Zapper gets its job done in 40ms, but the browser.. doesn't.
Try dropping the number of rows - I had good luck with 1,000.
Unless there's a templating engine also called Zapper, or a major web framework called Zapper, something in the same space at least, I don't see the point.
I wish this was added to the list of comment guidelines of things to avoid – one could argue it is a shallow dismissal.