2 ms·
I wonder how this compares to comemo [1] [2], they're both memoization frameworks with "tricks" to limit invalidation. The trick in comemo's blog post is to ma
by armchairhacker 3y ago
I wonder how this compares to comemo [1] [2], they're both memoization frameworks with "tricks" to limit invalidation.
The trick in comemo's blog post is to make the dependencies fine-grained, by tracking and only comparing what parts of them are actually used; while the trick here is to have functions depend on other outputs instead of the root input, so changes don't propagate all the way (+ laziness). But I'm sure some comemo functions are memoized on incremental computations, and salsa has some way to e.g. not recompute the entire AST when the source code changes.
I suspect there's also an issue where most incremental computations tend to invalidate way more than they need to; like if someone accidentally creates a function which takes a big array and an index, and only access the element at or a few elements around that index, but the anything in big array changing will cause it to be recomputed. So is there a system to profile what gets recomputed every time a query is run?
[1] https://laurmaedje.github.io/posts/comemo/ https://laurmaedje.github.io/posts/comemo/
[2] https://github.com/typst/comemo https://github.com/typst/comemo