最近做了JS模板引擎測試,拿各個JS模板引擎在不同瀏覽器上去運行同一程序,下面是模板引擎測試數據;通過測試artTemplate、juicer與doT引擎模板整體性能要有絕對優勢;
js模板引擎
引擎渲染速度競賽
100 條數據 × 10000 次渲染測試 [isEscape:false, isCache:true]
ie8瀏覽器(8.0.6001.18702)
chrome瀏覽器(版本 26.0.1410.64 m)
Apple safari瀏覽器(5.1.7(7534.57.2))
firefox瀏覽器(19.0.2)
奇虎360瀏覽器(版本號6.1.0.356,內核版本:21.0.1180.89)
測試結果
通過對各模板引擎測試結果,可以看出
artTemplate,juicer與doT引擎模板整體性能要有絕對優勢;
其中doT引擎模板在IE與safari瀏覽器表現非常優越;
tmpl模板引擎在IE中運行能完美勝出,但在其它瀏覽器中表現就差很多;
延伸
通過對模板引擎的熟知,不同瀏覽器渲染能力也不一樣;渲染快的打開網頁速度就快;chrome與360瀏覽器打開速是最快的;ie瀏覽器的速度是最慢;
各個模板引擎下載地址
baiduTemplate: http://baidufe.github.io/BaiduTemplate/
artTemplate: https://github.com/aui/artTemplate
juicer: http://juicer.name/或https://github.com/PaulGuo/Juicer/zipball/master#download
doT:doT source:https://github.com/olado/doT Docs:http://olado.github.com/doT/
tmpl:https://github.com/BorisMoore/jquery-tmpl
handlebars:http://handlebarsjs.com/或https://raw.github.com/wycats/handlebars.js/1.0.0-rc.4/dist/handlebars.js
easyTemplate:https://github.com/qitupstudios/easyTemplate
underscoretemplate: http://documentcloud.github.io/underscore/
mustache:https://github.com/janl/mustache.js
kissytemplate:https://github.com/ktmud/kissy
相關引擎資料
淺析js模板引擎
高性能JavaScript模板引擎原理解析
在前端開發中應用JS模板引擎 -- 事半功倍!
轉載自:http://blog.csdn.net/wuchengzhi82/article/details/8938122
程序員的基礎教程:菜鳥程序員