Skip to content

Conversation

@googleberg
Copy link
Member

@googleberg googleberg commented Nov 10, 2022

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

… 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
@googleberg googleberg merged commit 4f393bd into 21.x Nov 14, 2022
@jorgbrown jorgbrown mentioned this pull request Nov 29, 2022
gengliangwang added a commit to apache/spark that referenced this pull request Dec 13, 2022
### What changes were proposed in this pull request?

Upgrade Protobuf version to 3.21.11

### Why are the changes needed?

There are some bug fixes in the latest release https://github.com/protocolbuffers/protobuf/releases:
* Use bit-field int values in buildPartial to skip work on unset groups of fields. (protocolbuffers/protobuf#10960)
* Mark nested builder as clean after clear is called (protocolbuffers/protobuf#10984)

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

GA tests

Closes #39042 from gengliangwang/upgradeProtobuf.

Authored-by: Gengliang Wang <[email protected]>
Signed-off-by: Gengliang Wang <[email protected]>
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 18, 2022
### What changes were proposed in this pull request?

Upgrade Protobuf version to 3.21.11

### Why are the changes needed?

There are some bug fixes in the latest release https://github.com/protocolbuffers/protobuf/releases:
* Use bit-field int values in buildPartial to skip work on unset groups of fields. (protocolbuffers/protobuf#10960)
* Mark nested builder as clean after clear is called (protocolbuffers/protobuf#10984)

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

GA tests

Closes apache#39042 from gengliangwang/upgradeProtobuf.

Authored-by: Gengliang Wang <[email protected]>
Signed-off-by: Gengliang Wang <[email protected]>
@zhangskz zhangskz deleted the gberg-ads-performance branch February 15, 2023 19:00
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

Successfully merging this pull request may close these issues.

4 participants