Lazy reactive evaluation, performance optimisations #89
Reference in New Issue
Block a user
No description provided.
Delete Branch "new-reactive-system"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.