-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swap out Mustache rendering engines #62
Comments
Without looking detailed at it, my concern is stability and documentation. Mustache has been around a bit longer and tested throughout. Also examples and documentation can be found on the Internet. When (not if) openuserjs becomes popular performance will be a big issue, so if you think this will help... |
I wouldn't say that Mu has stellar documentation. It's pretty sparse. As far as stability is concerned, my implementation is much simpler and therefore easier to debug. I still need to fill it with comments. It was just an experiment on a theory I had of building a faster rendering engine.
Mustache documentation can be found on the internet. We're talking about the rendering engine. There are already two implementations written in JavaScript: Mustache and Mu. The first is written in pure JS and can run in the browser. The second is written for Node.js. I wrote a third, also for node.
Mu has been around for three years, but most of its commits are in the last year.
I'll give them that.
I do, but I agree that it needs more testing if we decide to use it. |
Don't know if it helps, but there are a lot of Mustache implementations in javascript, not just Mustache.js and Mu.
And they are probably more out there. Be aware that some of them are not being actively supported/developed. Mustache.js and Handlebars are the most active projects (the last one specially). Think it twice before reinventing the wheel. |
I know. I looked into them before rolling out my own version. I took a different approach than any of the others in my implementation. A template transformed into pure js will always be faster than evaluation. Apparently Mote does something similar but the advantage of keeping it in-house and not having to rely on someone else outweighs any benefits of using it imo.
I already did, so this advice is too late. I just need to finish it off by implementing support for partials. |
When the time comes for node @ 6 LTS mu2 will have to be swapped out, whether forked or actual replaced, unless that maintainer/author (@raycmorgan) comes alive. See also:
|
I wrote my own Mustache template rendering engine for Node.js awhile back. It is much faster and more memory efficient than Mu. Instead of building a parse tree in memory and then evaluating it to render (waking the parse tree and figuring out context.. ew), my engine transforms a template into a node module and then requires it. To render, it just passes the options to the module. The code is much simpler (so easier to optimize) and because it's a module, V8 can actually preform optimizations on the rendering code. I still need to implement Mustache partial syntax before it becomes a drop-in replacement for us. Template rendering speed and efficiency is important for us because we do it for essentially every request, and templates are just going to get more large and complex going forward.
The text was updated successfully, but these errors were encountered: