Why does Typst implements its own incremental computation (comemo) instead of using salsa?

Hi! I’ve been using Typst a bit and am enjoying it a lot! I’m also closely following some Rust packages being developed for the Python ecosystem, and noticed some traction around a new framework for incremental computation in Rust through the Salsa crate, which is the incremental computation backend for the insanely fast upcoming ty type checker for Python.

I’m wondering: might this simplify some of the incremental compilation implementation in the Typst backend? I’m not familiar with the source for Typst, but it seems to me like this would be a good fit and potentially further speed up compilation.

Thanks for the solid work!

Typst uses its own implementation comemo, which actually implements the same concept more or less.

As for why re-implementing, and not using salsa, I can only quote the Typst developers

The topic is recurring on Discord, because salsa does implement things that comemo doesn’t, or in different ways.

Ultimately, I think it would make the incremental compilation implementation more complicated than it is currently. Notably, you would need to spend a lot of time refactoring.

1 Like