Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store internals: Refactor RootStore/ToState to "Core" protocol composition #3460

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

stephencelis
Copy link
Member

Inspired by UIBinding's internals, this pull request refactors Store from a fully type-erased internal RootStore class and concretely composed key paths and closures using the internal ToState type to a more efficient internal protocol composition called "Core". Core preserves the underlying State and Action generics, avoiding unneeded, forced existential casts and it preserves the structure of individual key paths rather than appending the key paths directly, which is even known to be buggy. Benchmarks show an overall performance win here, if marginal, and the resulting code should be safer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants