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
compiler,reflect: make field offsets varints #3689
compiler,reflect: make field offsets varints #3689
Conversation
Impact on a production service built with
|
@dgryski size changed so CI failing. |
That's a much smaller effect than I expected, but I'll test the drivers repo too (hence why I'm working on #3687 to make this easier). |
@aykevl looking good to merge? |
I'll try to take a look soon. |
Did a quick check using the drivers smoke tests, and this does indeed result in a small binary size reduction (overall reduction of 0.21%) with a few exceptions where it increases binary size. So from that perspective, this PR looks good. I'll look at the implementation next. (When #3687 is in, checking this will become a ton easier as I don't have to run these tests manually). EDIT: 0.21% is actually really good, as #3656 added added 0.36% in binary size. That means that the sum increase is only 0.15% - less than half of the original increase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, with some suggestions how the implementation could be slightly more efficient.
offset, lenOffs := uvarint32(unsafe.Slice((*byte)(data), maxVarintLen32)) | ||
data = unsafe.Add(data, lenOffs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing to consider (although that might go a bit too far) is to not convert to a slice but work on raw pointers instead. That's a bit more dangerous, but may reduce binary size a little bit.
PTAL |
Fixes #3686