开发者

Dustjs: what about performance?

开发者 https://www.devze.com 2023-03-10 09:46 出处:网络
I like开发者_运维百科 syntax of this template library for JS. I\'m going to use it in Node.js script, so, performance is quite important. Have anybody tried this one? (Their web-site works too slow to

I like开发者_运维百科 syntax of this template library for JS. I'm going to use it in Node.js script, so, performance is quite important. Have anybody tried this one? (Their web-site works too slow to make me think their library works fast enough :) ).


Live performance comparisons of dust to other templating engines: http://akdubya.github.com/dustjs/benchmark/index.html. It basically blows the other libraries away (Mustache, Handlebars, and jQuery Templates).

If you aren't satisfied with those results, roll your own benchmark.


As for the slowness of the Dust "website" — it's just a github project page. I didn't notice any performance issues with the site.


Simple answer, checkout their benchmarks. The results are pretty staggering.


According to many tests on jsperf such as JavaScript template language shootoff the recommended answers get "blown" away by other template engines. I use doT as it can be customized to use <% %>, <%= %> and <%- %> tags.


I added Dust to the shootoff

http://jsperf.com/dom-vs-innerhtml-based-templating/281

Even precompiled Handlebars is 3x faster than Dust. I like Dust's syntax too, and I'm currently using it to build a product, but will probably switch to Handlebars if not DoT.

The thing about Dust is that it's super easy to precompile since blocks and partials simply use other templates interchangeably, while Handlebars and DoT require "Helper" and "Blocks" to be registered separately.

I wish there were scripts out there to pre-compile Handlebar template files and detect helpers/blocks. There's very little CLI documentation.

0

精彩评论

暂无评论...
验证码 换一张
取 消