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

Transition to salsa coarse-grained tracked structs #15763

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ibraheemdev
Copy link
Member

@ibraheemdev ibraheemdev commented Jan 27, 2025

Summary

Transition to using coarse-grained tracked structs (depends on salsa-rs/salsa#657). For now, this PR doesn't add any #[tracked] fields, meaning that any changes cause the entire struct to be invalidated. It also changes AstNodeRef to be compared/hashed by pointer address, instead of performing a deep AST comparison.

Test Plan

This yields a 10-15% improvement on my machine (though weirdly some runs were 5-10% without being flagged as inconsistent by criterion, is there some non-determinism involved?). It's possible that some of this is unrelated, I'll try applying the patch to the current salsa version to make sure.

@ibraheemdev ibraheemdev added the performance Potential performance improvement label Jan 27, 2025
@@ -18,7 +18,7 @@ use super::path::{ModulePath, SearchPath, SearchPathValidationError};

/// Resolves a module name to a module.
pub fn resolve_module(db: &dyn Db, module_name: &ModuleName) -> Option<Module> {
let interned_name = ModuleNameIngredient::new(db, module_name);
let interned_name = ModuleNameIngredient::new(db, module_name.clone());
Copy link
Member Author

Choose a reason for hiding this comment

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

This change was caused by the new bounds introduced in salsa-rs/salsa@f428a94. I'm not sure why there's no blanket implementation for &T anymore.

Copy link

codspeed-hq bot commented Jan 27, 2025

CodSpeed Performance Report

Merging #15763 will improve performances by 15.64%

Comparing ibraheemdev:salsa-coarse-deps (e6badd1) with main (3a08570)

Summary

⚡ 1 improvements
✅ 31 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
red_knot_check_file[incremental] 4.6 ms 4 ms +15.64%

@dhruvmanila dhruvmanila added the red-knot Multi-file analysis & type inference label Jan 27, 2025
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Potential performance improvement red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants