Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Do not call setItems() every time that the fuzzy finder is shown #373

Merged
merged 3 commits into from
Mar 28, 2019

Conversation

rafeca
Copy link
Contributor

@rafeca rafeca commented Mar 28, 2019

Description of the Change

This PR unblocks the work to use native-fuzzy to improve the filtering performance by mitigating one of its concerns.

Basically, before this PR the UI was blocked by the execution of the setItems() method every time the fuzzy finder was shown (and it delayed its appearance in the UI). This was not a big problem before because the setItems() method used to be quite fast, but with the addition of native-fuzzy we need to do more expensive things here (we need to serialize and pass the whole list of items to the native-fuzzy).

Alternate Designs

N/A

Benefits

  • Unblocking a big performance improvement.
  • Less work done every time the fuzzy finder is opened

Possible Drawbacks

N/A

Applicable Issues

#370

@rafeca rafeca self-assigned this Mar 28, 2019
@@ -734,6 +747,9 @@ describe('FuzzyFinder', () => {
await projectView.toggle()

expect(PathLoader.startTask).toHaveBeenCalled()

await waitForReCrawlerToFinish(projectView)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a very small behaviour difference with this PR: before when adding or removing a project from the current Atom window the fuzzy finder was temporarily shown as empty while it was recrawling the new list of projects. Now, it displays the old results while the re-crawling happens (which is consistent with what happens when a new file is added/removed).

Before:

before

Now:

now

Based on its description, this test was not doing the assertion correctly: instead of checking that the end list of results was empty was just checking that the temporary loading window was empty (which also could cause some flakiness if the crawling happened faster than the time it takes to open the fuzzy finder), so I fixed it.

@rafeca rafeca changed the title Avoid setitems Do not call setItems() every time that the fuzzy finder is shown Mar 28, 2019
With this commit, the Fuzzy finder will only call the setItems() method
on its view whenever the items change (which happen whenever it
re-crawls the filesystem).

This commit will allow us to do more expensive operations on the
setItems() phase without blocking the UI when toggling the fuzzy finder.
This common scenario was not covered and it's easy to cause a regression
on it.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants