Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/ci: reset git directory timestamps faster
The two added steps after actions/checkout added recently are fast enough on GitHub Actions with Linux, to the point where they both clock in at ~0s, not getting close to even one full second. However, they appear to clock in at 7-8s and 1-2s respectively on both Mac and Windows. Presumably, this is because those environments are a bit slower, and syscalls and I/O are a bit slower as well. As a baseline, when running on my laptop, git-restore-mtime takes 120ms. In comparison, our existing command for directories takes about 200ms: $ time find . -not -path '*/.*' -type d -exec touch -t 202211302355 {} \; real 0m0.205s user 0m0.163s sys 0m0.039s This seems to agree with the CI numbers: the first of the two steps is unnecessarily slow. Instead of running the command `touch` separately for each file, run it on all the files at once, which saves time: $ time touch -t 202211302355 $(find * -type d) real 0m0.007s user 0m0.001s sys 0m0.006s Also note that we can replace `-not -path '*/.*'` to skip over .git/ by using `*` as an argument to find, which gives the same result. After this change, both Mac and Windows reset the timestamps on directories in under a second, much faster than the previous 7-8s. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: If654ec94dae69d477b291af8daefe6cf2b3cfbc8 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/551246 TryBot-Result: CUEcueckoo <cueckoo@cuelang.org> Reviewed-by: Paul Jolly <paul@myitcv.io>
- Loading branch information