-
Notifications
You must be signed in to change notification settings - Fork 548
Compiler Lecture: How Salsa works #401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Would be great if @nikomatsakis can also review this :) |
After the database is formed, it can be accessed with queries that are basically going to work like functions. | ||
Since each query is going to be stored in the database, when a query is invoked N times, it's going to return N **cloned** results, without having to recompute the query (unless the input has changed in such a way that it warrants recomputation). | ||
|
||
For each input query (0-key), there's going to be a "set" method, that allows to change the output of such query, and trigger previous memoized values to be potentially invalidated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the "going to be" phrasing makes it sound like these are features that Salsa could have in the future, but doesn't currently. I'd review the text to phrase it in the present tense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are talking about this section specifically, it's because this refers to something that's going to happen when the library is used... If talking about the whole article: the text is based of a video done a while ago, some stuff might not had yet been implemented by that point. I don't know what's in salsa now so I can't really tell if something should be on the present tense. Either way, I decided to rewrite this section a bit with present tense as you suggested
Thanks @shepmaster! Co-Authored-By: Jake Goulding <shepmaster@mac.com>
@Karrq sorry for the delay. I will try to get to this soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Karrq Thanks so much for your patience and hard work!
This looks good to me. If you are able to address the nits below, that would be great. If you don't have time/interest, then I can just merge and do that in a followup PR.
|
||
The first thing that Salsa has to do is identify the "base inputs" [^EN1]. | ||
|
||
Then Salsa has to also identify intermidiate, "derived" values, which are something that the library produces, but, for each derived value there's a "pure" function that computes the derived value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then Salsa has to also identify intermidiate, "derived" values, which are something that the library produces, but, for each derived value there's a "pure" function that computes the derived value. | |
Then Salsa has to also identify intermediate, "derived" values, which are something that the library produces, but, for each derived value there's a "pure" function that computes the derived value. |
@@ -31,6 +31,7 @@ | |||
- [The Query Evaluation Model in Detail](./queries/query-evaluation-model-in-detail.md) | |||
- [Incremental compilation](./queries/incremental-compilation.md) | |||
- [Incremental compilation In Detail](./queries/incremental-compilation-in-detail.md) | |||
- [How Salsa works](./compiler_lectures/how_salsa_works.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps move this after the debugging subchapter?
|
||
## What is Salsa? | ||
|
||
Salsa is a library for incremental recomputation, this means reusing computation that has already been done in the past to increase the efficiency of future computations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps add a note that it is not used directly in rustc, but it is used extensively for rust-analyzer and may be integrated into the compiler in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly what @mark-i-m is mentioning here is what I was going to ask :).
Oh, also, could you wrap the lines to 100 chars? That will appease the CI. |
This is good enough, I saw some parts that mention something about inaudible parts of the video, I'm not sure what you plan to do with those. If we can get rid of those with something that still makes sense I think it would be better. Anyway, also agreed with @mark-i-m, thanks for your hard work and this is good enough to merge if you prefer to fix the nits in a follow up or just have us figuring those out :). |
#355
cc @spastorino
Some questions left regarding content (see footnotes).
Other doubts (from me):