Skip to content

Refactor identify using smallvec#982

Merged
j178 merged 1 commit intomasterfrom
tag-set
Oct 28, 2025
Merged

Refactor identify using smallvec#982
j178 merged 1 commit intomasterfrom
tag-set

Conversation

@j178
Copy link
Owner

@j178 j178 commented Oct 28, 2025

hyperfine --warmup 3 'prek run -a trailing-whitespace' './target/release/prek run -a trailing-whitespace'
Benchmark 1: prek run -a trailing-whitespace
  Time (mean ± σ):      56.6 ms ±   7.8 ms    [User: 28.1 ms, System: 35.7 ms]
  Range (min … max):    48.0 ms …  73.0 ms    37 runs

Benchmark 2: ./target/release/prek run -a trailing-whitespace
  Time (mean ± σ):      51.0 ms ±   2.6 ms    [User: 28.1 ms, System: 35.3 ms]
  Range (min … max):    48.1 ms …  61.5 ms    46 runs

Summary
  ./target/release/prek run -a trailing-whitespace ran
    1.11 ± 0.16 times faster than prek run -a trailing-whitespace

@j178 j178 added the performance Performance improvements label Oct 28, 2025
@codecov
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

❌ Patch coverage is 99.23664% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.94%. Comparing base (8dee1b5) to head (cac05dc).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/identify.rs 99.23% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #982      +/-   ##
==========================================
- Coverage   90.03%   89.94%   -0.10%     
==========================================
  Files          66       66              
  Lines       12344    12227     -117     
==========================================
- Hits        11114    10997     -117     
  Misses       1230     1230              

☔ 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.

```console
❯ hyperfine --warmup 3 'prek run -a trailing-whitespace' './target/release/prek run -a trailing-whitespace'
Benchmark 1: prek run -a trailing-whitespace
  Time (mean ± σ):      56.6 ms ±   7.8 ms    [User: 28.1 ms, System: 35.7 ms]
  Range (min … max):    48.0 ms …  73.0 ms    37 runs

Benchmark 2: ./target/release/prek run -a trailing-whitespace
  Time (mean ± σ):      51.0 ms ±   2.6 ms    [User: 28.1 ms, System: 35.3 ms]
  Range (min … max):    48.1 ms …  61.5 ms    46 runs

Summary
  ./target/release/prek run -a trailing-whitespace ran
    1.11 ± 0.16 times faster than prek run -a trailing-whitespace
```
@github-actions
Copy link

📦 Cargo Bloat Comparison

Binary size change: -0.62% (16.2 MiB → 16.1 MiB)

Expand for cargo-bloat output

PR Branch Results

 File  .text     Size          Crate Name
 0.6%   1.3% 101.1KiB          prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.5%   1.2%  88.0KiB           prek prek::languages::<impl prek::config::Language>::run::{{closure}}
 0.5%   1.1%  85.8KiB           prek prek::builtin::pre_commit_hooks::Implemented::run::{{closure}}
 0.4%   0.9%  63.8KiB           prek prek::archive::unpack::{{closure}}
 0.3%   0.7%  49.2KiB           prek prek::run::{{closure}}
 0.3%   0.6%  42.0KiB           prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.5%  40.9KiB regex_automata regex_automata::meta::strategy::new
 0.2%   0.5%  40.1KiB          prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.2%   0.4%  32.9KiB           prek prek::workspace::Workspace::discover
 0.2%   0.4%  32.8KiB           prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4%  32.3KiB           prek prek::languages::node::installer::NodeInstaller::install::{{closure}}
 0.2%   0.4%  31.8KiB             h2 h2::proto::connection::DynConnection<B>::recv_frame
 0.2%   0.4%  31.7KiB             h2 h2::proto::connection::Connection<T,P,B>::poll
 0.2%   0.4%  27.6KiB           prek prek::identify::by_extension::{{closure}}
 0.2%   0.3%  26.2KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::send_request::{{closure}}
 0.2%   0.3%  25.8KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::connect_to::{{closure}}::{{closure}}::{{closure}}
 0.2%   0.3%  25.0KiB        globset globset::GlobSetBuilder::build
 0.2%   0.3%  25.0KiB           prek prek::main
 0.1%   0.3%  24.2KiB           prek prek::languages::golang::installer::GoInstaller::install::{{closure}}
 0.1%   0.3%  23.7KiB          hyper hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_loop
39.8%  87.7%   6.4MiB                And 10186 smaller methods. Use -n N to show more.
45.4% 100.0%   7.3MiB                .text section size, the file size is 16.1MiB

Base Branch Results

 File  .text     Size          Crate Name
 0.6%   1.3% 101.1KiB          prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.5%   1.2%  88.0KiB           prek prek::languages::<impl prek::config::Language>::run::{{closure}}
 0.5%   1.1%  85.8KiB           prek prek::builtin::pre_commit_hooks::Implemented::run::{{closure}}
 0.4%   0.8%  63.8KiB           prek prek::archive::unpack::{{closure}}
 0.3%   0.7%  49.2KiB           prek prek::run::{{closure}}
 0.3%   0.6%  42.0KiB           prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.5%  40.9KiB regex_automata regex_automata::meta::strategy::new
 0.2%   0.5%  40.1KiB          prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.2%   0.5%  38.5KiB           prek prek::identify::by_extension::{{closure}}
 0.2%   0.4%  32.9KiB           prek prek::workspace::Workspace::discover
 0.2%   0.4%  32.8KiB           prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4%  32.3KiB           prek prek::languages::node::installer::NodeInstaller::install::{{closure}}
 0.2%   0.4%  31.8KiB             h2 h2::proto::connection::DynConnection<B>::recv_frame
 0.2%   0.4%  31.7KiB             h2 h2::proto::connection::Connection<T,P,B>::poll
 0.2%   0.3%  26.2KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::send_request::{{closure}}
 0.2%   0.3%  25.8KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::connect_to::{{closure}}::{{closure}}::{{closure}}
 0.2%   0.3%  25.0KiB        globset globset::GlobSetBuilder::build
 0.2%   0.3%  25.0KiB           prek prek::main
 0.1%   0.3%  24.2KiB           prek prek::languages::golang::installer::GoInstaller::install::{{closure}}
 0.1%   0.3%  23.7KiB          hyper hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_loop
39.7%  87.5%   6.4MiB                And 10186 smaller methods. Use -n N to show more.
45.4% 100.0%   7.3MiB                .text section size, the file size is 16.2MiB

@j178 j178 merged commit a18d363 into master Oct 28, 2025
21 checks passed
@j178 j178 deleted the tag-set branch October 28, 2025 08:16
feliblo pushed a commit to feliblo/prek that referenced this pull request Oct 29, 2025
```console
❯ hyperfine --warmup 3 'prek run -a trailing-whitespace' './target/release/prek run -a trailing-whitespace'
Benchmark 1: prek run -a trailing-whitespace
  Time (mean ± σ):      56.6 ms ±   7.8 ms    [User: 28.1 ms, System: 35.7 ms]
  Range (min … max):    48.0 ms …  73.0 ms    37 runs

Benchmark 2: ./target/release/prek run -a trailing-whitespace
  Time (mean ± σ):      51.0 ms ±   2.6 ms    [User: 28.1 ms, System: 35.3 ms]
  Range (min … max):    48.1 ms …  61.5 ms    46 runs

Summary
  ./target/release/prek run -a trailing-whitespace ran
    1.11 ± 0.16 times faster than prek run -a trailing-whitespace
```
feliblo pushed a commit to feliblo/prek that referenced this pull request Oct 29, 2025
```console
❯ hyperfine --warmup 3 'prek run -a trailing-whitespace' './target/release/prek run -a trailing-whitespace'
Benchmark 1: prek run -a trailing-whitespace
  Time (mean ± σ):      56.6 ms ±   7.8 ms    [User: 28.1 ms, System: 35.7 ms]
  Range (min … max):    48.0 ms …  73.0 ms    37 runs

Benchmark 2: ./target/release/prek run -a trailing-whitespace
  Time (mean ± σ):      51.0 ms ±   2.6 ms    [User: 28.1 ms, System: 35.3 ms]
  Range (min … max):    48.1 ms …  61.5 ms    46 runs

Summary
  ./target/release/prek run -a trailing-whitespace ran
    1.11 ± 0.16 times faster than prek run -a trailing-whitespace
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant