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

organize the go struct, in order to save memory. #1348

Closed
snikaein opened this issue Jul 10, 2017 · 3 comments
Closed

organize the go struct, in order to save memory. #1348

snikaein opened this issue Jul 10, 2017 · 3 comments

Comments

@snikaein
Copy link

i think this is good idea to write some plugin to organize the go struct for memory efficiency automatically ? i don't see any tools to do that .
take look at this https://github.com/Tkanos/optimizing-memory-by-ordering-struct-by-type
@fatih thanks

@icholy
Copy link

icholy commented Jul 10, 2017

The memory layout of a struct's fields is undefined. AFAIK, the compiler currently preserves the order, but this should not be relied on.

@arp242
Copy link
Contributor

arp242 commented Jul 10, 2017

Useful commands: https://github.com/mdempsky/maligned https://go-review.googlesource.com/c/2179/3/cmd/wasted/main.go

Discussion about having the Go compiler do it: golang/go#10014

It seems to me that this is a "niche issue". Sure, in some situations you care enough about the memory layout to do this, but those situations are few and far in-between; most of the time you couldn't care less.

@fatih
Copy link
Owner

fatih commented Jul 22, 2017

Hi everyone 👋

I don't think this is something we should tackle. as @Carpetsmoker said this is definitely under the "niche" region. Thanks for the feedback.

@fatih fatih closed this as completed Jul 22, 2017
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

4 participants