Lazy reactive evaluation, performance optimisations #89

Merged
thesabinelim merged 1 commits from new-reactive-system into master 2023-05-26 00:48:55 +08:00
thesabinelim commented 2023-05-25 23:42:05 +08:00 (Migrated from github.com)

Reactive values are now evaluated in a lazy manner, meaning that only the bare minimum number of evaluations necessary to resolve all effects is performed. Observables or derived values that aren't depended on by any effects will not be re-evaluated. Branches in the dependency graph that don't lead to an effect will not be re-evaluated. This is accomplished using a system very similar to what is described here: https://github.com/modderme123/reactively/blob/main/Reactive-algorithms.md

This new system also introduces a status flag for reactive nodes, where a node will avoid re-evaluating unless one or more of its dependencies have updated. In the case of observable values, they will not produce any updates if they are set to the same value.

Additionally introduces basalt.transaction. Within a transaction, multiple updates to a single observable value will only lead to a single re-evaluation of the dependency graph.

Reactive values are now evaluated in a lazy manner, meaning that only the bare minimum number of evaluations necessary to resolve all effects is performed. Observables or derived values that aren't depended on by any effects will not be re-evaluated. Branches in the dependency graph that don't lead to an effect will not be re-evaluated. This is accomplished using a system very similar to what is described here: https://github.com/modderme123/reactively/blob/main/Reactive-algorithms.md This new system also introduces a status flag for reactive nodes, where a node will avoid re-evaluating unless one or more of its dependencies have updated. In the case of observable values, they will not produce any updates if they are set to the same value. Additionally introduces `basalt.transaction`. Within a transaction, multiple updates to a single observable value will only lead to a single re-evaluation of the dependency graph.
Sign in to join this conversation.
No description provided.