Wednesday, September 4, 2013

Knockout performance in Internet Explorer 8

Knockout offers a lot of advantages, but when in comes to IE8 there are some things to consider:

1) Minimize the number of observables you have. Sometimes it's not necessary to have observables for everything, so if you don't need to observe a variable, don't declare it as one. I have received an alert in IE8 saying "a script is running slow in the page" because of this.

2) Plugins and advanced techniques sometimes generate the same alert "a script is running slow in the page". This happened to me when I used the mapping plugin, so I ended up doing the mapping manually instead of using the plugin. My guess is that the flexibility of the plugin comes with the need to execute more lines of code. That's why sometimes it's better to "hardcode" the steps instead of letting knockout "do the magic". At least for IE8.