Previously, limitations in the fuzzy-native API required us to call fs.existsSync on the main thread in order to map the relative paths in match results back into absolute paths in the presence of multiple project roots. This could block the main thread for an arbitrary amount of time and lead to performance degradation, so we decided to fix it.
The fix involved changing fuzzy-native's API to associate each match candidate with an integer identifier. Currently, we're just assigning each item's id to its index in the items array. Now, when we get a match back from fuzzy-native, we can map it back to the original item that produced the candidate via the match's id. This removes the need for synchronous I/O to disambiguate the relative path.
Alternate Designs
I'd love to replace fuzzy-native entirely, but that's out of scope right now.
Benefits
We no longer perform blocking I/O on the main thread, which could lead to performance problems.
The code for processing match results from fuzzy-native is much simpler.
Possible Drawbacks
Our fork of fuzzy-native has diverged even further from the upstream repository, but my understanding is that it is mostly unmaintained anyway.
🍐'd with @rafeca
Description of the Change
Previously, limitations in the
fuzzy-native
API required us to callfs.existsSync
on the main thread in order to map the relative paths in match results back into absolute paths in the presence of multiple project roots. This could block the main thread for an arbitrary amount of time and lead to performance degradation, so we decided to fix it.The fix involved changing
fuzzy-native
's API to associate each match candidate with an integer identifier. Currently, we're just assigning each item's id to its index in the items array. Now, when we get a match back fromfuzzy-native
, we can map it back to the original item that produced the candidate via the match's id. This removes the need for synchronous I/O to disambiguate the relative path.Alternate Designs
I'd love to replace fuzzy-native entirely, but that's out of scope right now.
Benefits
fuzzy-native
is much simpler.Possible Drawbacks
fuzzy-native
has diverged even further from the upstream repository, but my understanding is that it is mostly unmaintained anyway.Applicable Issues
383
382
https://github.com/atom/fuzzy-native/pull/3