-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: investigate a hybrid memory clearing strategy based on prove results #57000
Comments
In what situations would we know that the size is >X but not constant? |
I dumped it from prove and didn't get to confirm whether this ends up being compiled to a call to memclrNoHeapPointers or not, but: go/src/cmd/link/internal/ld/data.go Line 2275 in cf93b25
It seems that if prove was able to have a min limit on the len then we could use it to setup the static clear. |
I don't follow how that snippet of code is relevant to this issue. |
A simple example could be something like:
|
This seems like an exceedingly rare situation. I'd want to see a situation where this actually triggers before we spend time on it. Since we have to call into the runtime anyway, it also seems like a really small win. |
On a related note, maybe we could use PGO to find clears where one clear size dominates. If they are almost always x we could inline the most common clear and then have check if size == x (otherwise call memclrnoheappointers). |
In some cases, it might be better/faster to have a hybrid memory clear where from prove we know that a clear will be at least X bytes long.
We could use a static clear and then handle the unknown-sized remainder (either via a call to memclrNoHeapPointers or some inlined clear for the remainder). This could improve performance or allow more optimizations to fire due to the static clear part enabling things like DSE.
The text was updated successfully, but these errors were encountered: