-
Notifications
You must be signed in to change notification settings - Fork 232
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
Create a new bitmap structure that is value-based as opposed to interface-based #228
Comments
Have we tried changing only the |
I have not checked but I am almost certain that it gets allocated on the heap. Go is very conservative with its escape analysis. It is quite difficult to avoid heap allocation. I am not sure what you have in mind. I do invite experimentation. It is trivial in Go to find out the result of escape analysis (good!) but it is almost always the same result (heap allocation). I'd love to be proven wrong. |
Yeah, I don't remember the flags but it's quite trivial. What I thought was either making a copy of the output in the same line (the object becomes unreachable, hopefully dying soon) or, alternatively, using a new constructor that returns a value object. I do not remember if escape analysis flags function arguments in any way that let callers know they don't cause their arguments to escape, but if it does I think that should be enough help for it to know it doesn't need to keep the new instance (created as value) on the heap. |
In any case, the change I propose is easy to try, and I only need the escape analysis output. I'll see if I can do it soon. |
This incomplete PR outlined potential performance gains when replacing interface/reference containers with value-based containers. The performance difference would be particularly notable for users creating many small bitmaps. This would require a new API that could be created.
#149
The text was updated successfully, but these errors were encountered: