GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Switch from pre-commit to prek by QuLogic · Pull Request #31081 · matplotlib/matplotlib

Conversation

@QuLogic

@QuLogic QuLogic commented Feb 5, 2026

Copy link
Copy Markdown
Member

PR summary

Following the benchmarks from Hugo van Kemenade, we get about 3× faster with prek:

pre-commit prek Ratio
run --all-files 4m52.503s 1m26.718s 3.373
install-hooks 3m31.002s 1m6.608s 3.168
hyperfine 176.214 58.500 3.01

with hyperfine results of:

Benchmark 1: prek install-hooks
  Time (mean ± σ):     58.500 s ± 15.029 s    [User: 8.485 s, System: 3.138 s]
  Range (min … max):   30.766 s … 76.617 s    10 runs

Benchmark 2: pre-commit install-hooks
  Time (mean ± σ):     176.214 s ± 11.544 s    [User: 31.003 s, System: 5.127 s]
  Range (min … max):   161.969 s … 198.271 s    10 runs

Summary
  prek install-hooks ran
    3.01 ± 0.80 times faster than pre-commit install-hooks

These benchmarks were run on my desktop, which is several generations behind, but was more idle than my laptop. I would run on my laptop (which is still about 5 years old), but I don't really want to wait for hyperfine to do another long run like that.

Since we aren't using pre-commit's CI anyway, it's easy to switch GitHub Actions directly.

PR checklist

  • [n/a] "closes #0000" is in the body of the PR description to link the related issue
  • new and changed code is tested
  • [n/a] Plotting related features are demonstrated in an example
  • [n/a] New Features and API Changes are noted with a directive and release note
  • [n/a] Documentation complies with general and docstring guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bjlittle reacted with heart emoji rcomer reacted with rocket emoji melissawm reacted with eyes emoji
All reactions
  • ❤️ 1 reaction
  • 🚀 1 reaction
  • 👀 1 reaction
@QuLogic
Switch from pre-commit to prek
dda01c6
Following the [benchmarks from Hugo van
Kemenade](https://hugovk.dev/blog/2025/ready-prek-go/), we get about 3×
faster with prek:
|                 | pre-commit | prek      | Ratio |
| --------------- | ---------- | --------- | ----- |
| run --all-files | 4m52.503s  | 1m26.718s | 3.373 |
| install-hooks   | 3m31.002s  | 1m6.608s  | 3.168 |
| hyperfine       | 176.214    | 58.500    | 3.01  |

with hyperfine results of:
```
Benchmark 1: prek install-hooks
  Time (mean ± σ):     58.500 s ± 15.029 s    [User: 8.485 s, System: 3.138 s]
  Range (min … max):   30.766 s … 76.617 s    10 runs

Benchmark 2: pre-commit install-hooks
  Time (mean ± σ):     176.214 s ± 11.544 s    [User: 31.003 s, System: 5.127 s]
  Range (min … max):   161.969 s … 198.271 s    10 runs

Summary
  prek install-hooks ran
    3.01 ± 0.80 times faster than pre-commit install-hooks
```
@QuLogic QuLogic added the status: needs comment/discussion needs consensus on next step label Feb 5, 2026
@github-actions github-actions Bot added the Documentation: devdocs files in doc/devel label Feb 5, 2026
@tacaswell

tacaswell commented Feb 5, 2026

Copy link
Copy Markdown
Member

Sounds like upstream of prek is also reasonable to work with which is a major plus.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tacaswell
tacaswell approved these changes Feb 5, 2026
View reviewed changes
story645
story645 approved these changes Feb 5, 2026
View reviewed changes

@story645 story645 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for updating the dev docs!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
timhoffm
timhoffm approved these changes Feb 5, 2026
View reviewed changes
@rcomer

rcomer commented Feb 5, 2026

Copy link
Copy Markdown
Member

Where does the speedup for run come from? Is it just that run is also installing or is something else going on?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@QuLogic

QuLogic commented Feb 5, 2026

Copy link
Copy Markdown
Member Author

This is without the cache, so it is also installing all venvs required for running the linters. For day-to-day, it's probably not so much faster, except when we start changing configs or something that requires rebuilding them. As Hugo mentioned, I think, this doesn't do anything for speeding up the linters themselves. That is, mypy is probably going to be the slowest thing if it has to go through all files. While prek does have a fast path for some of the regular hooks, I don't think we have enough code for those to dominate times at all.

If I edit one file, git add it, and run without --all-files, it's about 1.21× faster (but still pretty quick):

$ hyperfine 'prek run' 'pre-commit run'
Benchmark 1: prek run
  Time (mean ± σ):     881.3 ms ± 210.7 ms    [User: 412.3 ms, System: 186.2 ms]
  Range (min … max):   584.5 ms … 1266.8 ms    10 runs
 
Benchmark 2: pre-commit run
  Time (mean ± σ):      1.063 s ±  0.114 s    [User: 0.671 s, System: 0.244 s]
  Range (min … max):    0.908 s …  1.292 s    10 runs
 
Summary
  prek run ran
    1.21 ± 0.32 times faster than pre-commit run
rcomer reacted with thumbs up emoji rcomer and bjlittle reacted with rocket emoji
All reactions
  • 👍 1 reaction
  • 🚀 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rcomer

rcomer commented Feb 5, 2026

Copy link
Copy Markdown
Member

Even just the install speedup is nice to have. Yesterday I used my clone on my work machine for the first time in a while, and was kind of annoyed about having to wait for those hooks to install!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bjlittle

bjlittle commented Feb 5, 2026

Copy link
Copy Markdown

The improved disk usage offered by prek over pre-commit is a BIG and most welcome win AFAIK 💪

The number of times I've had to purge a scary amount of GBs from my pre-commit cache ... lost count 😬

rcomer reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greglucas
greglucas approved these changes Feb 5, 2026
View reviewed changes
@greglucas greglucas removed the status: needs comment/discussion needs consensus on next step label Feb 5, 2026
@greglucas
greglucas merged commit c45ee4a into matplotlib:main Feb 5, 2026
40 of 43 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@QuLogic
QuLogic deleted the prek branch February 5, 2026 20:29
@QuLogic QuLogic added this to the v3.11.0 milestone Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@tacaswell tacaswell tacaswell approved these changes
@story645 story645 story645 approved these changes
@timhoffm timhoffm timhoffm approved these changes
@greglucas greglucas greglucas approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

Documentation: devdocs files in doc/devel

Projects

None yet

Milestone

v3.11.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@QuLogic @tacaswell @rcomer @bjlittle @story645 @timhoffm @greglucas
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.