projectkudu/kudu — pull request #944 by suwatch (2014-01-04 00:46:53+00:00)
Title: fix #894 console hang with large number of files

There are two issues causing the browser to hang (busy).

First, items are push one-by-one to ko.observable, this causes the UI to update for each inserted item (slow). I fixed by pushing range of items instead of one-by-one - UI will be updated once. Even with this, after a few hundred items, the UI perf will again degrade. I introduce maxViewItems (default is 100) and one could override via localStorage.

Second, the sort function is slow for large array. I fixed by ensuring the order in ko.observableArray to have folders before files (as a result, display folders before files). Within folders and files, the server always returns in alphabetical order (no extra sort needed).

As unrelated fix, I cleanup the wait for Task complexity. In 4.5, default .NET policy on unobserved faulted task is ignored (unlike 4.0, where the process will crash).