Skip to content

[gRPC] Design support for controlling integral type encodings #631

Closed

Description

Protobuf supports many integer types, and most types control the encoding of the integer as part of the binary-packed protobuf message.

  • int32 / int64 : variable-length 32/64 bit signed integers, inefficient for negative numbers
  • uint32 / uint64 : variable-length 32/64 bit unsigned integers
  • sint32 / sint64 variable-length 32/64 bit signed integers, more efficient for negative numbers
  • fixed32/fixed64 fixed-length 4/8 byte unsigned integer, more efficient than uint32/uint64 if values are often greater than 2^{28} / 2^{56}
  • sfixed32/sfixed64 fixed-length 32/64 bit signed integers, always 4/8 bytes

In the prototype, we are mapping Cadl int32/int64/uint32/uint64 to the same-named types in Protobuf, but we should expose these encoding knobs to developers, since they can have a big impact on the performance characteristics of a service.

Activity

  1. witemple-msft commented on Jun 21, 2022

    @witemple-msft
    MemberAuthor

    gRPC Priority: 1
    Points Estimate: 3
    Needs Design - possibly just default to variable-length int32/int64 and uint32/uint64 and use decorators to designate sint/fixed/sfixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions