-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Protocol Buffers Handbook
By :

Now that we know the two major algorithms behind integer encoding, we can reflect a little bit on how to choose between them. We will cover the three considerations that we need to think about when we decide between the integer types: number range, sign, and data distribution.
As we saw, Protobuf’s 32 and 64 suffixes on integer type names do not always represent the number of bits it takes to encode a value. We saw that it is better to think about them as the range of values that can be encoded.
This means that, when choosing an integer type, we need to be aware of the range of values needed for a specific use case. Let’s consider three examples:
For the first one, we can assume that our company will have less than 2 billion employees. The biggest companies in terms of employees, at the time of writing this book,...