Run same-depth projects concurrently#2110
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2110 +/- ##
==========================================
- Coverage 92.36% 92.16% -0.21%
==========================================
Files 121 121
Lines 24847 25358 +511
==========================================
+ Hits 22951 23372 +421
- Misses 1896 1986 +90 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📦 Cargo Bloat ComparisonBinary size change: -0.38% (26.3 MiB → 26.2 MiB) Expand for cargo-bloat outputHead Branch ResultsBase Branch Results |
⚡️ Hyperfine BenchmarksSummary: 1 regressions, 2 improvements above the 10% threshold. Environment
CLI CommandsBenchmarking basic commands in the main repo:
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base --version |
2.4 ± 0.1 | 2.2 | 2.6 | 1.01 ± 0.05 |
prek-head --version |
2.4 ± 0.1 | 2.2 | 2.6 | 1.00 |
prek list
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base list |
9.7 ± 0.4 | 9.0 | 10.9 | 1.04 ± 0.05 |
prek-head list |
9.3 ± 0.2 | 9.0 | 9.9 | 1.00 |
prek validate-config .pre-commit-config.yaml
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base validate-config .pre-commit-config.yaml |
3.2 ± 0.0 | 3.1 | 3.3 | 1.01 ± 0.02 |
prek-head validate-config .pre-commit-config.yaml |
3.2 ± 0.1 | 3.1 | 3.4 | 1.00 |
prek sample-config
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base sample-config |
2.7 ± 0.1 | 2.5 | 3.0 | 1.01 ± 0.04 |
prek-head sample-config |
2.6 ± 0.1 | 2.5 | 2.8 | 1.00 |
Cold vs Warm Runs
Comparing first run (cold) vs subsequent runs (warm cache):
prek run --all-files (cold - no cache)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run --all-files |
79.9 ± 3.2 | 77.2 | 86.5 | 1.02 ± 0.05 |
prek-head run --all-files |
78.1 ± 1.6 | 76.5 | 81.8 | 1.00 |
prek run --all-files (warm - with cache)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run --all-files |
75.6 ± 2.1 | 72.9 | 80.7 | 1.01 ± 0.04 |
prek-head run --all-files |
75.0 ± 2.2 | 72.3 | 80.9 | 1.00 |
Full Hook Suite
Running the builtin hook suite on the benchmark workspace:
prek run --all-files (full builtin hook suite)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run --all-files |
76.9 ± 2.0 | 73.9 | 82.8 | 1.01 ± 0.04 |
prek-head run --all-files |
76.4 ± 2.2 | 73.0 | 81.5 | 1.00 |
Individual Hook Performance
Benchmarking each hook individually on the test repo:
prek run trailing-whitespace --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run trailing-whitespace --all-files |
20.6 ± 0.4 | 19.9 | 21.4 | 1.02 ± 0.03 |
prek-head run trailing-whitespace --all-files |
20.2 ± 0.4 | 19.7 | 21.0 | 1.00 |
prek run end-of-file-fixer --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run end-of-file-fixer --all-files |
25.0 ± 1.4 | 23.4 | 28.5 | 1.00 |
prek-head run end-of-file-fixer --all-files |
26.3 ± 1.8 | 23.2 | 29.7 | 1.05 ± 0.09 |
prek run check-json --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-json --all-files |
8.3 ± 0.3 | 7.7 | 9.3 | 1.00 |
prek-head run check-json --all-files |
8.3 ± 0.2 | 7.8 | 8.7 | 1.00 ± 0.05 |
prek run check-yaml --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-yaml --all-files |
7.9 ± 0.1 | 7.6 | 8.2 | 1.01 ± 0.03 |
prek-head run check-yaml --all-files |
7.8 ± 0.2 | 7.6 | 8.5 | 1.00 |
prek run check-toml --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-toml --all-files |
8.5 ± 1.0 | 7.6 | 11.7 | 1.06 ± 0.13 |
prek-head run check-toml --all-files |
8.0 ± 0.2 | 7.6 | 8.4 | 1.00 |
prek run check-xml --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-xml --all-files |
7.9 ± 0.2 | 7.6 | 8.4 | 1.00 |
prek-head run check-xml --all-files |
8.1 ± 0.2 | 7.7 | 8.5 | 1.02 ± 0.04 |
prek run detect-private-key --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run detect-private-key --all-files |
13.4 ± 1.1 | 12.0 | 15.4 | 1.01 ± 0.11 |
prek-head run detect-private-key --all-files |
13.3 ± 1.1 | 11.4 | 15.5 | 1.00 |
prek run fix-byte-order-marker --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run fix-byte-order-marker --all-files |
22.3 ± 1.9 | 19.6 | 28.0 | 1.00 |
prek-head run fix-byte-order-marker --all-files |
22.4 ± 1.8 | 19.7 | 25.2 | 1.00 ± 0.12 |
Installation Performance
Benchmarking hook installation (fast path hooks skip Python setup):
prek install-hooks (cold - no cache)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base install-hooks |
4.8 ± 0.1 | 4.7 | 4.9 | 1.01 ± 0.02 |
prek-head install-hooks |
4.8 ± 0.1 | 4.7 | 4.8 | 1.00 |
prek install-hooks (warm - with cache)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base install-hooks |
4.7 ± 0.1 | 4.6 | 4.8 | 1.00 |
prek-head install-hooks |
4.7 ± 0.1 | 4.6 | 4.8 | 1.01 ± 0.02 |
File Filtering/Scoping Performance
Testing different file selection modes:
prek run (staged files only)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run |
40.4 ± 1.1 | 38.6 | 42.0 | 1.01 ± 0.03 |
prek-head run |
40.0 ± 0.7 | 39.0 | 41.5 | 1.00 |
prek run --files '*.json' (specific file type)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run --files '*.json' |
8.5 ± 0.1 | 8.3 | 8.7 | 1.00 ± 0.02 |
prek-head run --files '*.json' |
8.5 ± 0.1 | 8.2 | 8.7 | 1.00 |
Workspace Discovery & Initialization
Benchmarking hook discovery and initialization overhead:
prek run --dry-run --all-files (measures init overhead)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run --dry-run --all-files |
7.4 ± 0.1 | 7.2 | 7.6 | 1.00 |
prek-head run --dry-run --all-files |
8.2 ± 0.8 | 7.5 | 10.0 | 1.10 ± 0.11 |
prek run --dry-run --all-files (measures init overhead): 10.4500% slower
Meta Hooks Performance
Benchmarking meta hooks separately:
prek run check-hooks-apply --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-hooks-apply --all-files |
13.0 ± 0.2 | 12.8 | 13.5 | 1.14 ± 0.02 |
prek-head run check-hooks-apply --all-files |
11.4 ± 0.1 | 11.2 | 11.5 | 1.00 |
✅ Performance improvement for prek run check-hooks-apply --all-files: 12.4000% faster
prek run check-useless-excludes --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-useless-excludes --all-files |
38.4 ± 55.3 | 11.2 | 203.5 | 3.37 ± 4.85 |
prek-head run check-useless-excludes --all-files |
11.4 ± 0.2 | 11.1 | 12.0 | 1.00 |
✅ Performance improvement for prek run check-useless-excludes --all-files: 70.3200% faster
prek run identity --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run identity --all-files |
10.5 ± 0.1 | 10.4 | 10.6 | 1.00 |
prek-head run identity --all-files |
10.7 ± 0.1 | 10.5 | 11.0 | 1.02 ± 0.01 |
There was a problem hiding this comment.
Pull request overview
This PR implements workspace-mode concurrency by running hooks from projects at the same directory depth in parallel (while keeping deepest-to-shallowest ordering), and updates the CLI reporting to keep output stable/deterministic under concurrency.
Changes:
- Execute same-depth workspace projects concurrently and then render results in a stable order.
- Refactor file ownership/consumption tracking to support parallel project execution at a depth level.
- Update hook progress reporting to include pass/fail status and introduce project-level progress grouping; add workspace concurrency tests and adjust docs.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/workspace.md | Documents same-depth concurrency and updates example output (currently not aligned with implementation output). |
| crates/prek/tests/workspace.rs | Adds tests for same-depth concurrency + fail-fast depth-level behavior (snapshots currently expect old header format). |
| crates/prek/src/workspace.rs | Adds Project::display_name() for workspace-root naming in UI. |
| crates/prek/src/cli/run/run.rs | Implements depth-level project concurrency + stable rendering; refactors hook input prep and output formatting. |
| crates/prek/src/cli/run/filter.rs | Adjusts project file consumption APIs to support per-level tracking for concurrency. |
| crates/prek/src/cli/reporter.rs | Enhances run reporter to show project grouping and render completed lines with pass/fail. |
| crates/prek/src/hooks/mod.rs | Updates fast-path completion reporting to include pass/fail. |
| crates/prek/src/hooks/meta_hooks.rs | Updates completion reporting and adapts to new ProjectFiles::visit_for_project signature. |
| crates/prek/src/hooks/builtin_hooks/mod.rs | Updates completion reporting to include pass/fail. |
| crates/prek/src/languages/* | Updates language runners to report completion with pass/fail based on aggregated exit status. |
1a7b33d to
13efa89
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
b333de5 to
e739966
Compare
|
Hey @potiuk, this is ready for testing now :). I did a quick test against the Airflow repo, and it looks like this should bring a significant speedup to the overall prek check time. However, I’m still not entirely sure about the correctness, so I’d really appreciate hearing how it works in your actual runs before I merge this. |
14b9c7d to
8a6d677
Compare
8a6d677 to
784d945
Compare
Closes #673