use Access() instead of Lstat() for frequent use (#11911)

using Lstat() is causing tiny memory allocations,
that are usually wasted and never used, instead
we can simply uses Access() call that does 0
memory allocations.
This commit is contained in:
Harshavardhana
2021-03-29 08:07:23 -07:00
committed by GitHub
parent 7c5b35d20f
commit d93c6cb9c7
9 changed files with 101 additions and 67 deletions

View File

@@ -24,6 +24,11 @@ import (
"syscall"
)
func access(name string) error {
_, err := os.Lstat(name)
return err
}
// Return all the entries at the directory dirPath.
func readDir(dirPath string) (entries []string, err error) {
return readDirN(dirPath, -1)