-
Notifications
You must be signed in to change notification settings - Fork 80
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
Add field alignment #192
Add field alignment #192
Conversation
Hey @lukaszraczylo thank you for taking the time to submit a PR here. Could you just explain the motive for this, is it purely a syntax / tidy up of the code in this PR? There are no functional changes in this? |
Hi @hawksight, I spoke about it with @davidcollom privately. Bit of read if you're interested - https://levelup.gitconnected.com/struct-optimization-a-small-change-for-a-huge-impact-1f816c783014 |
Hey @lukaszraczylo Thanks for raising this, would you be able to provide us with some rough benchmarking values or before/after so that we can see how much we're likely to save? |
If this turns out to be a worthwhile optimisation, should we add some sort of CI tooling/linter to ensure this happens for new/edited structs? |
Hi @ribbybibby / @davidcollom, Ps. There's another PR from me - with significant improvement of the pipeline execution time. |
I took a look at betteralign and found the following from prior to this PR:
Along with an after (this branch):
There's not a huge improvement in my opinion - but as @ribbybibby and I raised, if we could implement something like |
I'm not entirely against this, but I do think that this is an optimisation at the cost of code legibility. For example, here: https://github.com/jetstack/version-checker/pull/192/files#diff-0be7332a6934801efa8562d347d9cf7829eabdc6b85795cb68dd5696bf7edc5cR396-R401 I would always expect that the I was curious why this wasn't just a compiler optimisation, and found this: golang/go#10014 (comment) - tldr; memory optimisation may come at the cost of an increase in cache misses. On the whole, without benchmarks (of both memory and runtime) to support this change, I'd argue that the optimisation here isn't worth the cost of reduced legibility. |
This Pull Request is stale because it has been open for 60 days with |
No description provided.