Skip to content
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

Restore Salsa DB for exploring Salsa further #11338

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

MichaReiser
Copy link
Member

No description provided.

Copy link
Contributor

github-actions bot commented May 8, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@MichaReiser MichaReiser reopened this May 28, 2024
Copy link

codspeed-hq bot commented May 28, 2024

CodSpeed Performance Report

Merging #11338 will not alter performance

Comparing red-knot-salsa (4e2ec9f) with main (9b6d2ce)

Summary

✅ 30 untouched benchmarks

}

#[salsa::tracked(jar=Jar)]
pub struct ResolvedModule {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlexWaygood this is where I'm currently landing on a Salsa design for a module resolver. I think it would simplify a lot for you because you no longer need to think about invalidation, Salsa will take care of that for you. The only thing necessary for this to work is that you use db.file(path).exists() to test if a file exists.

But check out resolve_module, it's now almost empty!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks for the ping. Yes, this indeed does make the code look a lot cleaner! It was making my head hurt a little bit to see all the cache-checking stuff right alongside the search-path semantics in resolve_module()

Comment on lines +184 to +190
pub fn path_to_module(db: &dyn Db, path: &Path) -> Option<ResolvedModule> {
let file = db.file(path.to_path_buf());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit weird that path_to_module converts the path to a file as the very first thing only so that file_to_module then reads the path. However, for file_to_module to be a salsa query, it can only accept an ingredient as an argument and file is an ingredient but path isn't.

@MichaReiser MichaReiser force-pushed the red-knot-salsa branch 2 times, most recently from a7d17b5 to 44bfbe2 Compare May 31, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants