1.Pure C runtime
2.Small code size (2–10 kB depending on processor, plus any message definitions)
3.Small ram usage (typically ~300 bytes, plus any message structs)
4.Allows specifying maximum size for strings and arrays, so that they can be allocated statically.
5.No malloc needed: everything can be allocated statically or on the stack. Optional malloc support available.
6.You can use either encoder or decoder alone to cut the code size in half.
7.Support for most protobuf features, including: all data types, nested submessages, default values, repeated and optional fields, oneofs, packed arrays, extension fields.
8.Callback mechanism for handling messages larger than can fit in available RAM.
9.Extensive set of tests.
主要是项目中控制器与上位机使用protobuf定义数据和双向传输比较清晰,nonaPB是第三方实现的兼容protobuf的纯C实现
nanoPB Features
1.Pure C runtime
2.Small code size (2–10 kB depending on processor, plus any message definitions)
3.Small ram usage (typically ~300 bytes, plus any message structs)
4.Allows specifying maximum size for strings and arrays, so that they can be allocated statically.
5.No malloc needed: everything can be allocated statically or on the stack. Optional malloc support available.
6.You can use either encoder or decoder alone to cut the code size in half.
7.Support for most protobuf features, including: all data types, nested submessages, default values, repeated and optional fields, oneofs, packed arrays, extension fields.
8.Callback mechanism for handling messages larger than can fit in available RAM.
9.Extensive set of tests.
至于protobuf本身的优点,官网讲了一堆,可以看看:
https://developers.google.com/pr ... /overview#whynotxml
谢谢兄台。
一周热门 更多>