1

Does using the protobuf Any time improve performance? Currently, I have a couple of services that just pass data through without doing any transformations. Would using the Any type save on cpu cycles spent serializing/deserializing data?

pradyuman
  • 1,089
  • 2
  • 14
  • 20
  • You may also be interested in [FlatBuffers](https://google.github.io/flatbuffers/). – yeputons Feb 22 '17 at 01:46
  • PB main page: "... mechanism for serializing _structured data_". You "just pass data without any transformations". Why are you looking for any kind of wire encoding at all? Just send the data. – Pavel Zdenek Feb 22 '17 at 07:20

1 Answers1

1

Packing a message inside an Any will prevent the intermediate services that just pass it through from packing and unpacking it. Roughly speaking, if the time it takes to serialize+deserialize this message is larger than what it takes to serialize+deserialize an Any containing that message, then you may be able to save some CPU time, though I would suggest to measure first.

thesamet
  • 6,382
  • 2
  • 31
  • 42