Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/mod/modpkgload: skip fs.Stat before fs.ReadDir
Calling fs.Stat before fs.ReadDir used to be crucial to catch cases where a local package being loaded was a regular file rather than a directory, and we have had test cases for that scenario for some time. Since the recent cue/load and modules refactors, this extra io/fs work appears to no longer be necessary, as we just capture missing files, which can be done with fs.ReadDir easily. This reduces the number of syscalls for a single and all packages from $ strace -f -t -e trace=file cue fmt ./internal/ci |& grep '/home/mvdan/src' | wc -l 96 $ strace -f -t -e trace=file cue fmt ./... |& grep '/home/mvdan/src' | wc -l 5256 by about 5% and 0.5% to $ strace -f -t -e trace=file cue fmt ./internal/ci |& grep '/home/mvdan/src' | wc -l 90 $ strace -f -t -e trace=file cue fmt ./... |& grep '/home/mvdan/src' | wc -l 5224 Updates #3155. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: Id706a0ef83e7bf29869c8a99faeb7ae5db1537e9
- Loading branch information