knockout.js是在填补observableArray太慢 [英] knockout.js is too slow in filling observableArray
问题描述
我创造比较角度和基因敲除试验:
I create test for the comparing angular and knockout:
items = self.items();
// ...
self.items.valueHasMutated();
http://jsfiddle.net/imbolc/z7bkz/9/embedded/result /
这是测试是否正确?你知道KO增加灌装速度的方式?
Is this test correct? Do you know way for increase KO filling speed?
推荐答案
我也没搞比较逻辑中间人你不同的测试,但我知道有一些问题与Chrome的如何处理文本节点如下所述:<一HREF =https://github.com/SteveSanderson/knockout/issues/793相对=nofollow> https://github.com/SteveSanderson/knockout/issues/793
I did not thoroughly compare the logic betweens your different tests, but I do know that there are some issues with how Chrome processes text nodes as described here: https://github.com/SteveSanderson/knockout/issues/793
如果你带从内联模板KO文本节点,那么你在Chrome中看到在性能上巨大的推动。
If you strip the text nodes from your inline KO template, then you see a big boost in performance in Chrome.
我爱:
<ul id="ko-list" data-bind="foreach: items"><li>ko: <span data-bind="text: val"></span></li></ul>
更新的示例: http://jsfiddle.net/rniemeyer/tsTmZ/
样的结果在最新的Chrome:
Sample results in the latest Chrome:
jQuery的:45毫秒74毫秒
jquery: 45 ms 74 ms
角度:171毫秒到199毫秒。
angular: 171 ms 199 ms
淘汰赛:109毫秒25毫秒
knockout: 109 ms 25 ms
这篇关于knockout.js是在填补observableArray太慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!