-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Open
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
I recently wrote a function:
func CurrentOpenFDs() int { .... }... to return how many file descriptors are open by the process. For Linux, the naive implementation is:
func CurrentOpenFDs() int {
ents, _ := os.ReadDir("/proc/self/fd")
return len(ents)
}... but that allocates a bunch. Enough that it showed up disturbingly high in profiles. (worse: the more FDs open, the worse it is)
With some unsafe and Linux-specific stuff, you can get it down to zero allocations (e.g. tailscale/tailscale#2785).
Any objections to a unix.ParseDirent variant that parses dirents without allocating?
Then https://pkg.go.dev/golang.org/x/tools/internal/fastwalk could also use it.
smasher164, cespare, jmhodges, thesyncim, bjorndm and 4 more
Metadata
Metadata
Assignees
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
Status
Triage Backlog