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

Optimize for pointer slots too #6

Closed
mdempsky opened this issue Aug 31, 2016 · 2 comments
Closed

Optimize for pointer slots too #6

mdempsky opened this issue Aug 31, 2016 · 2 comments

Comments

@mdempsky
Copy link
Owner

When scanning objects during GC, the standard compiler/runtime only scan as far as the last pointer slot in an object. If fields are sorted so that all of the pointer-y fields come first, then the GC may be able to short-circuit its scan work slightly.

@erwanor
Copy link

erwanor commented Oct 12, 2017

Nice, I can implement that. Would you rather leave to the user to specify which they want to prioritize (struct alignment or GC optimization) or just print both? Otherwise, what criteria to use to decide which one has the most priority?

@mdempsky
Copy link
Owner Author

mdempsky commented Oct 12, 2017

I would probably just favor size over pointers-first. I think pointers-first is a smaller win than using less memory.

That said, off hand I can't think of any struct layouts where the two layout strategies are actually in conflict. If you have one, please share.

CAFxX added a commit to CAFxX/maligned that referenced this issue Mar 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants