Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
DO NOT MERGE: add span_based_serialization design #6874
DO NOT MERGE: add span_based_serialization design #6874
Changes from 2 commits
41c92c3
1e81823
8ae06c9
bb28883
47bc281
d4242bc
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
We already have the test base classes for sharing some tests between the implementations.
Once code gen is complete then tests that serialize/deserialize the entire message can also easily be tested with both. Same story with microbenchmarks.
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.
New consideration: Messages that wish to use new serialization reader/writer can't use other messages that aren't compiled to also support reader/writer. For this reason, it is important that well known types in Google.Protobuf all support IBufferMessage so they can be used by messages with the new reader/writer.
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.
Sg, the challenge might be with netstandard1.0 target which is not supported by System.Memory, so we will need to use the PROTOBUF_DISABLE_BUFFER_SERIALIZATION flag in the nestandard1.0 build of the runtime?
Same thing applies to the descriptor.proto types (which aren't classified as WKT, but still ship with the runtime).
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.
Yes. I don’t think this is a problem
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.
New consideration: can we do something about parsing / serialization of
bytes
fields? The issue is that if the message contains large ByteString fields, the new parsing API is not going to help much because all the data will be copied into newly allocatedbyte[]
objects. To some extent this is unavoidable, but we should at least give this some thought. AFAIKbytes
fields are fairly common in some use cases. e.g. for a hypotheticalFileDownloadService
, is there a way one could avoid the LOH allocations easily?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.
The new design will save one allocation/copy. Optimizing ByteString is a separate allocation/copy problem.
Renting the underlying storage is one option. However that would require a way for devs to say they are releasing the message.
Create a new issue for this.
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.
Some solutions to eliminating large ByteString allocations: #4206 (comment)
I think this is an issue to look at separately.