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

Use bit-field int values in buildPartial to skip work on unset groups of fields. #10960

Merged
merged 1 commit into from
Nov 14, 2022

Commits on Nov 10, 2022

  1. Use bit-field int values in buildPartial to skip work on unset groups…

    … of fields.
    
    Changes to make this improvement:
    1) All non-repeated builder fields (including maps) now have a presence bit regardless of syntax.
    2) The buildPartial method is split into one method per 32-field block (aligned with bit-mask ints)
    3) If a presence bit-mask int is set to 0, no fields are present, so we can skip the logic for all of those fields in the buildPartial step.
    
    For messages with a lot of fields (> 100) that are sparsely populated this can result in a significant improvement. Not only does it potentially skip a lot of field copying logic, but also breaks the buildPartial method into chunks that should be more easily digested by the JIT compiler as discussed in this issue: #10247.
    
    PiperOrigin-RevId: 485952448
    protobuf-github-bot authored and googleberg committed Nov 10, 2022
    Configuration menu
    Copy the full SHA
    b0f7bff View commit details
    Browse the repository at this point in the history