SteveSanderson/knockout — pull request #438 by farmdawgnation (2012-04-18 18:42:29+00:00)
Title: Better Dependency Searching

This branch implements a new method of checking for duplicate dependencies inside ko.dependencyDetection that uses Objects instead of Arrays. To facilitate this, I've added code to generate unique ID numbers for observables. So, checking to see if an observable is already listed as a dependency is just a matter of checking to see if its key is defined in the distinctDependencies object.

This change was made in response to significant performance issues in IE8 caused by the lack of a native Array.indexOf call. After implementing this change, the time spent inside registerDependency and the methods it calls went from the 2,000 to 2,500 ms ballpark down to the 75 ms to 200 ms ballpark when tested against our production site with IE8.

Let me know if you have any suggestions on how to improve this further!