-
Notifications
You must be signed in to change notification settings - Fork 0
perf(graph): do not rebuild TestFileFilter when the session already has one #836
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
Merged
jonathanong
merged 4 commits into
execute-plan/79dd0742-pr-5-normalized-path-membership-without-pathcmp
from
execute-plan/79dd0742-pr-6-reuse-prepared-testfilefilter-during-graph-config
Sep 5, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
017d0b0
perf(graph): do not rebuild TestFileFilter when the session already h…
jonathanong 697ae02
fix: address review feedback for perf: do not rebuild TestFileFilter
jonathanong 4ddb5c0
fix: split graph-gates session bench and session builder over line limit
jonathanong 5cfe6cd
test(graph): cover session DepGraph builder TestFileFilter reuse
jonathanong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
crates/no-mistakes/benches/core_analysis/graph_gates_session.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| use super::support::{traversal_snapshot, EXPECTED_GRAPH_NODES}; | ||
| use criterion::{black_box, BenchmarkId, Criterion, Throughput}; | ||
| use no_mistakes::codebase::analysis_session::AnalysisSession; | ||
| use no_mistakes::codebase::dependencies::graph::DepGraph; | ||
| use no_mistakes::codebase::ts_resolver::TsConfig; | ||
| use std::path::Path; | ||
| use std::sync::Arc; | ||
|
|
||
| pub(super) fn bench_graph_gates_session( | ||
| c: &mut Criterion, | ||
| root: &Path, | ||
| config: &TsConfig, | ||
| config_path: &Path, | ||
| session: Arc<AnalysisSession>, | ||
| unprepared: &DepGraph, | ||
| ) { | ||
| let session_preflight = DepGraph::build_with_plan_and_config_and_session( | ||
| root, | ||
| config, | ||
| super::support::gate_plan(), | ||
| Some(config_path), | ||
| Arc::clone(&session), | ||
| ) | ||
| .expect("graph-gates session preflight should succeed"); | ||
| assert_eq!( | ||
| traversal_snapshot(&session_preflight), | ||
| traversal_snapshot(unprepared), | ||
| "session-path graph build must preserve traversal order" | ||
| ); | ||
| drop(session_preflight); | ||
|
|
||
| let mut session_group = c.benchmark_group("graph_gates_build_session"); | ||
| session_group.throughput(Throughput::Elements(EXPECTED_GRAPH_NODES as u64)); | ||
| for threads in [1usize, 4] { | ||
| let pool = rayon::ThreadPoolBuilder::new() | ||
| .num_threads(threads) | ||
| .build() | ||
| .expect("graph-gates rayon pool"); | ||
| session_group.bench_with_input(BenchmarkId::from_parameter(threads), &threads, |b, _| { | ||
| b.iter(|| { | ||
| pool.install(|| { | ||
| black_box( | ||
| DepGraph::build_with_plan_and_config_and_session( | ||
| black_box(root), | ||
| black_box(config), | ||
| black_box(super::support::gate_plan()), | ||
| Some(black_box(config_path)), | ||
| black_box(Arc::clone(&session)), | ||
| ) | ||
| .expect("graph-gates session build should succeed"), | ||
| ) | ||
| }) | ||
| }); | ||
| }); | ||
| } | ||
| session_group.finish(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
crates/no-mistakes/src/codebase/dependencies/graph/builder_session.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| impl DepGraph { | ||
| pub(crate) fn build_with_plan_files_config_facts_and_session( | ||
| root: &Path, | ||
| tsconfig: &TsConfig, | ||
| plan: GraphBuildPlan, | ||
| graph_files: &GraphFiles, | ||
| config_path: Option<&Path>, | ||
| facts: Option<&dyn TsFactLookup>, | ||
| session: std::sync::Arc<crate::codebase::analysis_session::AnalysisSession>, | ||
| ) -> Result<Self> { | ||
| let config_options = graph_config_options_for_plan_with_config_and_session( | ||
| root, | ||
| plan, | ||
| config_path, | ||
| Some(&session), | ||
| Some(graph_files.all()), | ||
| ); | ||
| Self::build_with_plan_files_options_and_facts( | ||
| GraphEdgeBuildInputs { | ||
| root, | ||
| tsconfig, | ||
| tsconfig_catalog: None, | ||
| plan, | ||
| graph_files, | ||
| workspace: None, | ||
| config_options: config_options.as_ref(), | ||
| playwright_settings: &[], | ||
| config_path, | ||
| dotnet_facts: None, | ||
| swift_facts: None, | ||
| import_resolution_cache: None, | ||
| visible_paths: None, | ||
| workflow_documents: None, | ||
| interner: session.interner_arc(), | ||
| }, | ||
| facts, | ||
| SuppliedFactPolicy::FillSparse, | ||
| session, | ||
| ) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.