adobe/brackets — pull request #6434 by iwehrman (2014-01-09 18:33:20+00:00)
Title: Synchronize and throttle ProjectManager.refreshFileTree

This pull request changes the `ProjectManager` to try to limit the time spent refreshing the project tree. It makes some effort to ensure that successive calls to `refreshFileTree` are not interleaved, and ensures that there is at least a one second delay between calls. It also gives up on adding/removing individual entries to the tree as a result of file system events in lieu of a single full refresh if the queue of changes becomes too large.

The synchronization is imperfect, but hopefully better than what exists now.

Aside: performance is still very bad in case we get filesystem change events for a directory that is both open in the file tree and that has many (~1000) files. I think a big reason for this is the complexity of `_findTreeNode`. It seems like it would be *much* faster to just give each tree node an id that includes the file's full path and let jQuery do the search for us with something like `var node = $("#" + encodeURIComponent("file://" + file.fullPath))`.

@ryanstewart Would you mind testing this branch against the scenario you described in #6413?

CC @peterflynn @jasonsanjose