KO seems to be manipulating the DOM with every added DIV. Bypassing the DOM is expensive and slows down the rendering of your page. There is an open question for KO Github: https://github.com/SteveSanderson/knockout/issues/248
In my opinion, Knockout is currently not up to the task of processing large foreach datasets. Performance in Chrome is decent (because Chrome is awesome), but pretty poor in Internet Explorer (and even worse in older IE): http://jsfiddle.net/StarcounterJack/FgSCw/
Instead of using Knockout, try a manual approach: first create a DIV in memory and immediately insert them into the DOM. This is what you do in your second example with document.createElement (). With jQuery you can do this:
var newDiv = $("<div>my new div</div>"); var newDiv2 = $("<div>my new div2</div>"); newDiv.append(newDiv2); $('body').append(newDiv);
For templates, I prefer to use Mustache.js, download templates using the John Resig utility <head><script type="text/templates"> enable the template, and take care of rendering manually through my own JavaScript. You have more control over how these elements are rendered, and you can try different approaches when dealing with performance issues such as the one you have.
source share