SodiumFRP / sodium

Sodium - Functional Reactive Programming (FRP) Library for multiple languages
http://sodium.nz/
Other
851 stars 140 forks source link

Alternative to ranks & priority queue #179

Closed clinuxrulz closed 1 year ago

clinuxrulz commented 1 year ago

I've discussed this before. But I think I can do better now. Also sodium.nz is down, but not a big issue.

The idea is to when streamsinks are set during transaction, light up all its dependants and dependants of dependants etc. like a christmas tree with a dirty flag. Then after transaction those nodes are visited in any order, but if its dependencies are dirty, then they are updated before itself (recursively). After a node gets updated, its dirty flag gets cleared, and if a node gets visited and it is not dirty, then it is skipped.

The idea is more simple then the current rust implementation that uses a tristate flag (dirty, pending and clean). And it should visit fewer nodes as well.

There will probably also be a changed flag too. Just because a node gets updated, it doesn't mean its state has changed. (E.g. filter()).