Pushing and Pulling: Three reactivity algorithms
3 days ago
- #programming
- #reactivity
- #design-patterns
- The article discusses three reactivity algorithms: push-based, pull-based, and push-pull hybrid.
- Push-based reactivity updates dependents immediately upon change, ensuring fine-grained updates but can be inefficient and prone to glitches.
- Pull-based reactivity recalculates values on demand, making it glitchless and dynamic but potentially inefficient due to unnecessary recalculations.
- Push-pull reactivity combines both approaches: first marking nodes as dirty (push), then recalculating only the dirty nodes (pull), achieving efficiency, fine-grained updates, and glitchlessness.
- Each approach has trade-offs: push is simple but inefficient, pull is glitchless but can waste work, and push-pull offers a balanced solution.
- The article emphasizes the importance of efficiency, fine-grained updates, glitchlessness, and dynamic dependencies in reactive systems.