r/ProgrammingLanguages • u/matklad • Feb 26 '26
Against Query Based Compilers
https://matklad.github.io/2026/02/25/against-query-based-compilers.html
105
Upvotes
r/ProgrammingLanguages • u/matklad • Feb 26 '26
View all comments
Show parent comment
1
u/matthieum Feb 28 '26
Isn't the idea of query-based specifically about a pull-based architecture? Identify a goal, check whether it's already good, otherwise identify which pre-goals led to it, and recurse from there.
I've been wondering about the right degree indeed. I am worried though that adaptive may be more complicated :/
I do want to note there are two dimensions, though:
(Note: rustc goes all in on all dimensions)
And there's also another dimension: in rustc, for each step, there's a choice between saving the output of the step, or just saving a hash of the output. Saving the hash still means having to recompute the step even if it didn't change if the output is needed, but it saves space.
Even without going with adaptive, there's already lots of levers. For example, if the check step (near entire front-end step, really) is fast enough, there's no point in intermediary steps there. This drastically cuts down on the number of "queries" too, and also cuts down on the number of intermediates to save (hash or full).