Skip to content

Use pooled memory for ToByteArray in C# #8321

@jonso4

Description

@jonso4

What language does this apply to?
If it's a proto syntax change, is it for proto2 or proto3?
If it's about generated code change, what programming language?

Describe the problem you are trying to solve.
ToByteArray in C# allocates a buffer for the message. This can lead to performance impact and heavy GC load at scale.

Describe the solution you'd like
It would be great if ToByteArray could use pooled memory to avoid allocations. It would be great if Grpc could also be updated to use this version of ToByteArray.

Describe alternatives you've considered
I have considered manually serializing the message with pooled memory, but this seems better handled by Protobuf itself.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions