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

cmd/compile: static maps should preallocate size #15880

Closed
randall77 opened this issue May 29, 2016 · 1 comment
Closed

cmd/compile: static maps should preallocate size #15880

randall77 opened this issue May 29, 2016 · 1 comment

Comments

@randall77
Copy link
Contributor

var m = map[int]int {
  1:1,2:2,3:3,4:4
}

Generates a call to makemap with a hint set to 0. The hint should be set to 4. This will eliminate growing during initialization, which reduces significantly the allocations required at startup.
See #15872

@gopherbot
Copy link

CL https://golang.org/cl/23558 mentions this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants