forked from facebookexperimental/Recoil
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Earlier selector cache lookup (facebookexperimental#1720)
Summary: Pull Request resolved: facebookexperimental#1720 More red lines! While supporting some users I realized an opportunity to simplify the selector implementation slightly and optimize cache lookups to happen earlier. Previously, selectors would not cache their own value in the store state, only their dependencies. So, repeated lookups of a selector would require looking up in the more expensive selector tree cache. This optimization fixes that. It also makes `Snapshot` clones more robust by always cloning the `TreeState` to avoid snapshot selector lookup aching to inadvertently affect the parent store, which may cause atoms to skip initialization now that we are more aggresively caching. * Performance test of reading 100 selectors 100 times each took 1/3rd the time. * Performance test of reading 100 selectors with 100 dependencies 100 times each took 1/3rd the time. Differential Revision: https://www.internalfb.com/diff/D35492328?entry_point=27 fbshipit-source-id: 777d9e40ed23eb2e7ff276f489783b8f7553ddfb
- Loading branch information
1 parent
25143b6
commit 1077538
Showing
5 changed files
with
189 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.