Protocol Buffers 中 getSerializedSize() 的性能损失
在使用 writeTo(OutputStream)
序列化消息之前,对 GPB 消息调用 getSerializedSize()
是否会造成性能损失?
在将消息写入输出流之前,我需要能够知道消息的大小。
我在 Java 上使用 GPB。
Is there a performance penalty for calling getSerializedSize()
on a GPB message before serializing the message with writeTo(OutputStream)
?
I need to be able to know the size of a message before writing it to an output stream.
I'm using GPB on Java.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有性能损失。来自 Protobuf 邮件中此帖子的第二条消息列表:
There is no performance penalty. From the second message of this thread on the Protobuf mailing list: