gitcheck icon indicating copy to clipboard operation
gitcheck copied to clipboard

Stop traversal at maxdepth

Open mneudert opened this issue 7 years ago • 0 comments

Hi!

As a somewhat heavy user of gitcheck I regularly found that the "first check of the day" took rather long. Turns out that the maxdepth parameter was not applied to the actual traversal but only the output.

This PR is a proposal to change that behaviour. It is especially useful when having "cold storage" like after a system restart.

For reference I have measured some timings for my system (the separate number is the number of directories check if it is a git repository).

## master (cold storage)
> gitcheck --maxdepth 2 --quiet --dir=/data/projects
40392
2.38s user 2.45s system 19% cpu 24.155 total

## master (hot storage)
> gitcheck --maxdepth 2 --quiet --dir=/data/projects
40392
1.64s user 1.28s system 87% cpu 3.332 total

## traversal (cold storage)
> gitcheck --maxdepth 2 --quiet --dir=/data/projects
199
1.24s user 1.17s system 86% cpu 2.800 total

## traversal (hot storage)
> gitcheck --maxdepth 2 --quiet --dir=/data/projects
199
1.04s user 0.85s system 81% cpu 2.327 total

Your mileage obviously varies as both the directory count and timings depend on the type of disk used but it should generally be faster.

mneudert avatar Dec 06 '17 18:12 mneudert