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

runtime: sparse zeroing in mallocgc #24928

Open
josharian opened this issue Apr 18, 2018 · 1 comment
Open

runtime: sparse zeroing in mallocgc #24928

josharian opened this issue Apr 18, 2018 · 1 comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Performance
Milestone

Comments

@josharian
Copy link
Contributor

This is a performance idea; it needs experimentation to see whether it is worth it.

mallocgc accepts a flag to not zero the new allocation. It is used in a few places in the runtime where we know already that we'll entirely overwrite the new memory; #24926 contemplates having the compiler use it too.

mallocgc must however always zero the new allocation if it contains pointers; runtime uses check for pointers before asking for raw memory. However, we could change the meaning of the "don't zero" flag to mean "I'm going to overwrite all the memory". mallocgc could then decide to only zero the pointers in the new memory, instead of zeroing everything. The decision to only zero pointers might be helpful if pointers are sparse in the type. Deciding whether pointers are sparse in the type is probably something we would do at compile time and set a flag in the type.

@gopherbot
Copy link

Change https://golang.org/cl/367496 mentions this issue: cmd/compile: add memcrlelim SSA optimization pass

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Performance
Projects
None yet
Development

No branches or pull requests

2 participants