In the C++ MessageLite class, SerializeToArray calls ByteSize (Protobuf 
implementation) to determine what size is required to write to buffer. It 
then writes to the buffer using this size but only returns true if it was 
successful. Maybe it would be a better idea to return the size written to 
buffer (using 0 if unsuccessful). Under the current implementation we must 
call ByteSize twice, which is an expensive operation. Once to write to 
buffer and a second time on the client side to determine the size for 
sending.

If anyone has any reasoning behind the current design or alternative 
solutions please let me know. Or if this has been raised before feel free 
to leave a link. It would be great to hear your thoughts!

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to