VarintBitConverter | Varint encoding and decoding for .NET
kandi X-RAY | VarintBitConverter Summary
kandi X-RAY | VarintBitConverter Summary
Varint encoding and decoding for .NET
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of VarintBitConverter
VarintBitConverter Key Features
VarintBitConverter Examples and Code Snippets
Community Discussions
Trending Discussions on VarintBitConverter
QUESTION
I'm trying to figure out the final size of a file serialized with protobuf-net, so I'll can choose the best approach.
I made some comparison tests with different proto configurations and a binary serialization, but still I don't understand how "varint to bytes" conversion works.
Classes
...ANSWER
Answered 2017-Apr-08 at 08:321) testPt3D.pb length = 30 bytes
- (subclass comes first) [field 101, string] = 2 bytes, 3 bits for "string", 7 bits for "101"; varint packs in 7 bit units with a continuation bit, so: 2 bytes (total = 2)
- [data length "9"] = 1 byte (total = 3)
- [field 1, fixed 64] = 1 byte (total = 4)
- [payload 1] = 8 bytes (total = 12)
- [field 1, fixed 64] = 1 byte (total = 13)
- [payload 1] = 8 bytes (total = 21)
- [field 2, fixed 64] = 1 byte (total = 22)
- [payload 2] = 8 bytes (total = 30)
2) testFullPt3D.pb length = 27 bytes
- [field 1, fixed 64] = 1 byte (total = 1)
- [payload 1] = 8 bytes (total = 9)
- [field 2, fixed 64] = 1 byte (total = 10)
- [payload 2] = 8 bytes (total = 18)
- [field 3, fixed 64] = 1 byte (total = 19)
- [payload 3] = 8 bytes (total = 27)
There are other options in protobuf when dealing with repeated data - "packed" and "grouped"; they only make sense when discussing more data than 3 values, though.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install VarintBitConverter
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page