Improbable Icon

Schema: Varints in a list<int32>

v13-0

#1

Aaaand I’m back on the forums :wink:

Got a short technical question:

(I’m trying to figure out the cause of 1MBps update messages.)

Are lists of Varints in schema (sint32) still individually encoded in variable length?

In other words: If I have a list of 1000 integers, but they can all be contained in 7 bits (i.e. between [-63,63]), will the list update then take up ~1KB? Or do Varints in a list always take up the max size?


#3

Hi @noio Yes it will be encoded indiviually, we use Repeated Field in this stutiation and it will encoded same way it would be normally. ProtoBuff Link

Packed Repeated Fields

Version 2.1.0 introduced packed repeated fields, which in proto2 are declared like repeated fields but with the special [packed=true] option. In proto3, repeated fields are packed by default. These function like repeated fields, but are encoded differently. A packed repeated field containing zero elements does not appear in the encoded message. Otherwise, all of the elements of the field are packed into a single key-value pair with wire type 2 (length-delimited). Each element is encoded the same way it would be normally, except without a key preceding it.