4 ms·
> The second Salsa property is laziness. When changing the input, one can go and eagerly mark reverse-dependencies as “this might have changed”. This could crea
by o11c 3y ago
> The second Salsa property is laziness. When changing the input, one can go and eagerly mark reverse-dependencies as “this might have changed”. This could create redundant work — if two modifications arrive one-after-another in a row, invalidating everything twice is wasteful. Or there might be some top-level queries whose results are no longer interesting
Er, what? If you get 2 modifications before actually forcing the computation, the second won't have to mark anything since it will quickly see "this node is already dirty" and stop propagating the dirty flag upward.
The interesting optimizations to me are 1. when should nodes share a dirty flag, and 2. for what simplicity level should you just always redo the calculation (this is highly dependent on what kind of interpreter or compiler/runtime you're evaluating with).
- foota 3y agoI think a node can be partially dirty though, in the sense that some of the downstream outputs might have been recomputed but not all of them.