Skip to content

Run same-depth projects concurrently#2110

Merged
j178 merged 11 commits into
masterfrom
project-concurrency-ui
May 25, 2026
Merged

Run same-depth projects concurrently#2110
j178 merged 11 commits into
masterfrom
project-concurrency-ui

Conversation

@j178
Copy link
Copy Markdown
Owner

@j178 j178 commented May 20, 2026

Closes #673

@j178 j178 added the enhancement New feature or request label May 20, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

❌ Patch coverage is 88.16121% with 94 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.16%. Comparing base (1b811a7) to head (c29887d).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
crates/prek/src/cli/reporter.rs 75.00% 79 Missing ⚠️
crates/prek/src/cli/run/run.rs 97.28% 10 Missing ⚠️
crates/prek/src/cli/run/filter.rs 94.91% 3 Missing ⚠️
crates/prek/src/hook.rs 50.00% 1 Missing ⚠️
...ates/prek/src/hooks/pre_commit_hooks/check_yaml.rs 50.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@j178 j178 added the performance Performance improvements label May 20, 2026
@prek-ci-bot
Copy link
Copy Markdown

prek-ci-bot Bot commented May 20, 2026

📦 Cargo Bloat Comparison

Binary size change: -0.38% (26.3 MiB → 26.2 MiB)

Expand for cargo-bloat output

Head Branch Results

 File  .text     Size             Crate Name
 1.2%   2.6% 332.0KiB        aws_lc_sys aws_lc_0_41_0_aes_gcm_encrypt_avx512
 1.2%   2.6% 332.0KiB        aws_lc_sys aws_lc_0_41_0_aes_gcm_decrypt_avx512
 0.3%   0.7%  89.8KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6%  81.1KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.5%  69.8KiB              prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.5%  60.7KiB             prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.2%   0.4%  51.3KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.4%  48.2KiB              prek prek::run::{{closure}}
 0.2%   0.3%  42.2KiB              prek prek::cli::run::run::run::{{closure}}
 0.1%   0.3%  33.1KiB             prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.2%  30.6KiB             prek? <prek::config::_::<impl serde_core::de::Deserialize for prek::config::Config>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2%  29.6KiB               std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2%  28.1KiB      serde_saphyr granit_parser::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  28.0KiB        aws_lc_sys aws_lc_0_41_0_edwards25519_scalarmuldouble_alt
 0.1%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_41_0_edwards25519_scalarmuldouble
 0.1%   0.2%  26.0KiB              prek prek::cli::try_repo::try_repo::{{closure}}
 0.1%   0.2%  23.9KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2%  23.0KiB      serde_saphyr granit_parser::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  22.3KiB         [Unknown] Lp384_montjscalarmul_alt_p384_montjadd
 0.1%   0.2%  21.5KiB      clap_builder clap_builder::parser::parser::Parser::get_matches_with
41.6%  86.3%  10.9MiB                   And 23984 smaller methods. Use -n N to show more.
48.2% 100.0%  12.6MiB                   .text section size, the file size is 26.2MiB

Base Branch Results

 File  .text     Size             Crate Name
 1.2%   2.5% 332.0KiB        aws_lc_sys aws_lc_0_41_0_aes_gcm_encrypt_avx512
 1.2%   2.5% 332.0KiB        aws_lc_sys aws_lc_0_41_0_aes_gcm_decrypt_avx512
 0.3%   0.7%  90.8KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.7%  86.3KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.5%  70.0KiB              prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.5%  61.1KiB             prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.2%   0.4%  51.3KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.4%  46.9KiB              prek prek::cli::run::run::run::{{closure}}
 0.1%   0.3%  36.0KiB              prek prek::run::{{closure}}
 0.1%   0.3%  33.3KiB             prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.2%  30.4KiB             prek? <prek::config::_::<impl serde_core::de::Deserialize for prek::config::Config>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2%  30.2KiB               std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2%  28.1KiB      serde_saphyr granit_parser::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  28.0KiB        aws_lc_sys aws_lc_0_41_0_edwards25519_scalarmuldouble_alt
 0.1%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_41_0_edwards25519_scalarmuldouble
 0.1%   0.2%  26.5KiB              prek prek::cli::try_repo::try_repo::{{closure}}
 0.1%   0.2%  24.0KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2%  23.0KiB      serde_saphyr granit_parser::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  22.3KiB         [Unknown] Lp384_montjscalarmul_alt_p384_montjadd
 0.1%   0.2%  21.5KiB      clap_builder clap_builder::parser::parser::Parser::get_matches_with
41.8%  86.4%  11.0MiB                   And 24028 smaller methods. Use -n N to show more.
48.4% 100.0%  12.7MiB                   .text section size, the file size is 26.3MiB

@prek-ci-bot
Copy link
Copy Markdown

prek-ci-bot Bot commented May 20, 2026

⚡️ Hyperfine Benchmarks

Summary: 1 regressions, 2 improvements above the 10% threshold.

Environment
  • OS: Linux 6.17.0-1013-azure
  • CPU: 4 cores
  • prek version: prek 0.4.1+21 (7f64792 2026-05-25)
  • Rust version: rustc 1.95.0 (59807616e 2026-04-14)
  • Hyperfine version: hyperfine 1.20.0
CLI Commands

Benchmarking basic commands in the main repo:

prek --version

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

⚠️ Warning: Performance regression for 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

@j178 j178 marked this pull request as ready for review May 21, 2026 07:11
Copilot AI review requested due to automatic review settings May 21, 2026 07:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread crates/prek/src/cli/run/run.rs Outdated
Comment thread crates/prek/tests/workspace.rs Outdated
Comment thread docs/workspace.md Outdated
Comment thread docs/workspace.md Outdated
Comment thread crates/prek/src/cli/run/run.rs Outdated
Comment thread crates/prek/src/cli/reporter.rs Outdated
Copilot AI review requested due to automatic review settings May 21, 2026 07:59
@j178 j178 force-pushed the project-concurrency-ui branch from 1a7b33d to 13efa89 Compare May 21, 2026 07:59
j178 and others added 4 commits May 21, 2026 16:04
@j178 j178 force-pushed the project-concurrency-ui branch from b333de5 to e739966 Compare May 21, 2026 08:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.

Comment thread crates/prek/src/cli/reporter.rs Outdated
Copilot AI review requested due to automatic review settings May 21, 2026 10:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 34 out of 34 changed files in this pull request and generated 4 comments.

Comment thread crates/prek/src/languages/pygrep/pygrep.rs
Comment thread crates/prek/src/cli/run/run.rs Outdated
Comment thread crates/prek/src/cli/run/run.rs
Comment thread crates/prek/src/cli/run/run.rs Outdated
Copilot AI review requested due to automatic review settings May 23, 2026 12:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 53 out of 53 changed files in this pull request and generated 1 comment.

Comment thread crates/prek/src/cli/run/run.rs
@j178
Copy link
Copy Markdown
Owner Author

j178 commented May 23, 2026

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.

Copilot AI review requested due to automatic review settings May 24, 2026 15:16
@j178 j178 force-pushed the project-concurrency-ui branch from 14b9c7d to 8a6d677 Compare May 24, 2026 15:16
@j178 j178 force-pushed the project-concurrency-ui branch from 8a6d677 to 784d945 Compare May 24, 2026 15:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 55 out of 56 changed files in this pull request and generated 1 comment.

Comment thread crates/prek/src/cli/run/run.rs
Copilot AI review requested due to automatic review settings May 25, 2026 04:04
@j178 j178 merged commit 7cd6ba4 into master May 25, 2026
52 of 53 checks passed
@j178 j178 deleted the project-concurrency-ui branch May 25, 2026 04:08
@j178 j178 review requested due to automatic review settings May 25, 2026 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request performance Performance improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run hooks from different project concurrently

2 participants