Re: Use of repeated

2009-06-17 Thread Henner Zeller
On Tue, Jun 16, 2009 at 7:48 PM, skshe...@gmail.comskshe...@gmail.com wrote: I am experimenting with repeated fields my dot-proto is as follows: message Foo {    required string     name        = 1;    optional int32      id             = 2;    optional int32      num             = 3;    

Re: 'Streaming' messages (say over a socket)

2009-06-17 Thread Kenton Varda
Mostly looks fine. Note that a varint can be up to 5 bytes. You should probably just use CodedOutputStream::Varint32Size() to compute the exact size so that you can allocate a buffer that is exactly large enough. Also note that if your message is large (say, 10k or more), allocating a single

RE: 'Streaming' messages (say over a socket)

2009-06-17 Thread Alex Black
Thanks for pointing out CodedOuptutStream::Varint32Size(), I'll use that. My messages are lists of messages, and I am breaking them into batches of say 1,000 deliberately, so that each is a reasonable size that I can allocate a buffer for and send over the wire. In one scenario I have 100,000

Re: 'Streaming' messages (say over a socket)

2009-06-17 Thread Kenton Varda
Don't bother trying to implement your own std::ostream; it's a horrible mess. Using CopyingOutputStreamAdaptor only requires that you implement the CopyingOutputStream interface, which is extremely simple. But yeah, since your messages are small, what you have now is fine. On Wed, Jun 17, 2009