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 Bytes instead of Vec<u8> for protobuf binary fields #11342

Merged
merged 3 commits into from Dec 19, 2020

Conversation

tdyas
Copy link
Contributor

@tdyas tdyas commented Dec 18, 2020

Problem

#11307 upgraded the gRPC code to Tonic from grpcio. As part of that upgrade, Pants now uses Prost to generate Rust structs for protobuf types. By default, Prost encodes binary fields as Vec<u8>. Given the attendant problems of Vec<u8> of needing to copy around bytes when structs are cloned, the more efficient method is to use Bytes for the representation to avoid unnecessary copies.

Solution

Upgrade Prost to danburkert/prost@a1cccbc and enable using Bytes for all binary fields.

Result

Existing tests pass.

@tdyas tdyas changed the title use version of Prost with Bytes support use Bytes instead of Vec<u8> for protobuf binary fields Dec 18, 2020
Copy link
Sponsor Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

src/rust/engine/Cargo.toml Show resolved Hide resolved
Copy link
Contributor

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hurrah!

@tdyas tdyas merged commit 862ed2e into pantsbuild:master Dec 19, 2020
@tdyas tdyas deleted the prost_use_bytes branch December 19, 2020 03:36
tdyas pushed a commit that referenced this pull request Dec 19, 2020
### Problem

Landed #11342 without updating the `prost` crate version in the `concrete_time` crate.

### Solution

Update the revision to conform.

### Result

Existing tests pass.
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.

None yet

3 participants