Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maps: Equal should not allocate on the heap #65329

Closed
BrannonKing opened this issue Jan 27, 2024 · 3 comments
Closed

maps: Equal should not allocate on the heap #65329

BrannonKing opened this issue Jan 27, 2024 · 3 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@BrannonKing
Copy link

BrannonKing commented Jan 27, 2024

Go version

go1.21.6 linux/amd64

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='amd64'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go'
GOSUMDB='sum.golang.org'
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64'
GOVERSION='go1.21.6'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/brannon/Documents/Research/jobshop_go/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2066541701=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Ran the memory profiler for my application.

What did you see happen?

I saw that frequently iterating through a map with type map[uint16]uint32 was causing memory pressure. maps.Equal performs an iteration on one map and indexes into the other.
image

What did you expect to see?

I expected to be able to iterate over a map without allocating on the heap. Surely we can make maps.Equal not allocate on the heap. It seems that stepping through the bucket list shouldn't require a nondeterministic amount of memory.

@seankhliao seankhliao changed the title map iterator should not allocate on the heap maps: Equal should not allocate on the heap Jan 27, 2024
@seankhliao
Copy link
Member

can you please provide a minimal reproducer for the issue

@seankhliao seankhliao added Performance NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jan 27, 2024
@BrannonKing
Copy link
Author

BrannonKing commented Jan 27, 2024

provide a minimal reproducer

I just tried to reproduce it. I cannot reproduce it in any simple scenario. The code that fails will be open source in several months. I'll try to follow up on this then.

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 27, 2024
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants