Skip to content

Conversation

@rs-unity
Copy link
Owner

@rs-unity rs-unity commented Sep 10, 2025

Enable UseCachedSize in proto marshal to eliminate redundant size computation

The proto message size was previously being computed twice: once before marshalling and again during the marshalling call itself. In high-throughput workloads, this duplicated computation is expensive.

By enabling UseCachedSize on MarshalOptions, we reuse the size calculated immediately before marshalling, avoiding the second call to proto.Size.

In our application, the redundant size call accounted for ~12% of total CPU time. With this change, we eliminate that overhead while preserving correctness.

RELEASE NOTES:

  • proto: Reducing proto.Size calls when marshalling.

image image

@rs-unity rs-unity changed the title proto: enable use cached size option proto: enable UseCachedSize size option Sep 10, 2025
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.

2 participants