Incremental Computation Graphs

6 points by marcecoll


polywolf

See also https://thunderseethe.dev/posts/lsp-base/ which, while longer, i think flows a bit better as an introduction to the algorithm

(Also see also https://git.sr.ht/~polywolf/driver/tree/8b6396478fbba0fdf2b495d1bb0b90600db2c2ae/item/packages/driver-engine/src/context.rs#L183 where I implemented this algorithm myself!)

I always find it interesting the slightly different takes on the core red-green concept:

For each dependency we track also what was the changed-at revision of the dependency when we depended on it.

My implementation doesn't need this? And I can't find where in the rest of the algorithm we'd depend on that.

Also missing from most discussions is a twist I added to make the changed-at checking return false more often, by eagerly re-querying dependencies that may have changed in order to not re-run a potentially expensive function with no actually-changed deps.

(I should probably figure out what Salsa does someday, because that seems to be the "canonical" version of red-green. Maybe I'll write more on this but meh I don't have that much to add)

kchanqvq

Would this be useful? https://github.com/kchanqvq/lwcells It also handles some problems like glitch-free propagation, but I guess that's more relevant for GUI than compilers.