micromustache icon indicating copy to clipboard operation
micromustache copied to clipboard

Support async compile and rendering to avoid event loop for large & complex templates

Open alexewerlof opened this issue 5 years ago • 1 comments

The synchronous render() method can occupy the event loop if the input is huge. We can't do much about it without adding lots of complexity or relying on Workers. We could add a renderAsync() function that does the rendering work in chunks. Also have a look at tokenization because that can block the event loop too.

alexewerlof avatar Mar 05 '20 09:03 alexewerlof

This could be achieved by passing an identity function (x => x) to the renderFnAsync() but with the current setup the code wouldn't look super intuitive. It would be better to add a option for a function that allows processing varNames and turning them into something that render*() would use in its interpolation algorithm.

alexewerlof avatar Apr 12 '20 10:04 alexewerlof