-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Reorder variables structs to optimize memory #1257
Comments
This doesn't need to be done prelaunch, since all things that are put into memory are marshalled. Still would be cool to have, though its a bit of a micro-optimization. |
Running https://github.com/ValarDragon/maligned, we get that we should update the following structs:
|
Decided to close this in favor of leaving structs in their logical ordering. (It doesn't save that many bytes either way, so its not that impactful) |
Read this first: https://medium.com/@felipedutratine/how-to-organize-the-go-struct-in-order-to-save-memory-c78afcf59ec2 (Its short)
We should reorder the variables in all of our structs, to save on memory used. I've tagged this is as prelaunch, since I'm not sure if this can be changed easily postlaunch, as it may affect state variables / data encoding. (I don't actually know though, anyone who knows if our codec cares about the order variables appear in, feel free to chime in. Would be glad to make this post-launch if wire.codec didn't care about the order variables appeared in) From what I can gather, it doesn't look like this will be done automatically for us before go 2.0 (judging from this issue: golang/go#10014), so we'll have to reorder all of our structs ourselves.
The text was updated successfully, but these errors were encountered: