Summary
I was exploring prek on a huge work repo (tens of thousands of files) and noticed that it's about 3x slower than pre-commit. Looking at the trace log revealed that prek seems to be running git diff once per hook. Usually that would be fast but for us it often takes a few seconds, and that adds up when there's a few dozen hooks.
Could you instead run git diff once per invocation and reuse the result among hooks?
Platform
Darwin 25.2.0
Version
0.2.27
.pre-commit-config.yaml
No response
Log file
No response
Summary
I was exploring
prekon a huge work repo (tens of thousands of files) and noticed that it's about 3x slower than pre-commit. Looking at the trace log revealed thatprekseems to be runninggit diffonce per hook. Usually that would be fast but for us it often takes a few seconds, and that adds up when there's a few dozen hooks.Could you instead run
git diffonce per invocation and reuse the result among hooks?Platform
Darwin 25.2.0
Version
0.2.27
.pre-commit-config.yaml
No response
Log file
No response