ruff
4274342e - [ty] Speed up include filtering for projects with many literal include patterns (#25266)

Commit
19 hours ago
[ty] Speed up include filtering for projects with many literal include patterns (#25266) ## Summary - Track literal include globs in a bitset to avoid a linear scan over literal pattern indices. - Keep the existing fast path when an include filter has no literal patterns. - Add a ty benchmark that exercises a 1024-literal include set through `Project::is_file_included`. ## Benchmark Command: `cargo bench -p ruff_benchmark --bench ty --no-default-features --features ty_instrumented ty_include_filter -- --sample-size 10` Results: - `origin/main` with this benchmark added: `[1.4059 us 1.4082 us 1.4100 us]` - This PR: `[957.18 ns 961.50 ns 965.61 ns]` This is about 1.46x faster, or a 31.7% reduction in time per literal include match in this benchmark. ## Test Plan - `cargo test -p ty_project glob::include` - `cargo check -p ruff_benchmark --benches --no-default-features --features ty_instrumented` - `cargo bench -p ruff_benchmark --bench ty --no-default-features --features ty_instrumented ty_include_filter -- --sample-size 10` Refs #25244 --------- Co-authored-by: Micha Reiser <micha@reiser.io>
Parents
Loading