Re:A practical guide to protocol buffers in Go
by crawshaw on Saturday July 12, 2014 @04:22PM
(#8025683)
The most important piece of advice is not proto specific: use pprof. It may sound obvious, but even though I have been using it for years, I find myself still not running it enough.
Proto decoding specific: if you're parsing a message with lots of fields, you can define a new message with just the fields you care about. I.e. if you're parsing
message M {
optional int32 F1 = 1;
// ...
optional int32 F100 = 100;
}
but you only care about F1 and F2 in this message, define
Proto decoding specific: if you're parsing a message with lots of fields, you can define a new message with just the fields you care about. I.e. if you're parsing
but you only care about F1 and F2 in this message, define If you use SmallM to decode your messages, it will skip a lot of work filling out fields F3-F100, saving you a lot of CPU.