diff options
| author | Peter Collingbourne <pcc@google.com> | 2024-03-11 20:10:48 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-03-16 00:34:52 +0000 |
| commit | b822f098c557ea3d9200fd2d8a2e2b4d641e83e4 (patch) | |
| tree | ff5bd7207c526885f741ba5d99ee65e7a83765de /src/os/dir.go | |
| parent | bedda245740d766bfad36b2d91a22781575fe463 (diff) | |
| download | go-b822f098c557ea3d9200fd2d8a2e2b4d641e83e4.tar.xz | |
os: don't try to make the directory FD non-blocking in os.ReadDir
This will fail because epoll_ctl() fails on directory FDs, so we
end up issuing unnecessary syscalls. My test program that calls
filepath.WalkDir on a large directory tree runs 1.23 ± 0.04 times
faster than with the original implementation.
Change-Id: Ie33d798c48057a7b2d0bacac80fcdde5b5a8bb1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/570877
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/os/dir.go')
| -rw-r--r-- | src/os/dir.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/os/dir.go b/src/os/dir.go index 9124de29e8..dcc18e1814 100644 --- a/src/os/dir.go +++ b/src/os/dir.go @@ -115,7 +115,7 @@ var testingForceReadDirLstat bool // ReadDir returns the entries it was able to read before the error, // along with the error. func ReadDir(name string) ([]DirEntry, error) { - f, err := Open(name) + f, err := openDir(name) if err != nil { return nil, err } |
