Reading from a stream...
I've read the various useful posts on this discussion group about using popLimit() and pushLimit() to control how many bytes are read at a time when using a CodedInputStream, but is there an elegant way of detecting EOF/end of stream or is it simply a question of waiting for an exception to be thrown and then dealing with it? That seems a little inelegant. As a sidebar CodedInputStream is a bit of misnomer IMHO since it doesn't extend InputStream and have the usual stream handling facilities you would expect of a class with that name. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Re: Reading from a stream...
On Wed, Mar 18, 2009 at 8:31 AM, sauternes hossein.gho...@gmail.com wrote: I've read the various useful posts on this discussion group about using popLimit() and pushLimit() to control how many bytes are read at a time when using a CodedInputStream, but is there an elegant way of detecting EOF/end of stream or is it simply a question of waiting for an exception to be thrown and then dealing with it? That seems a little inelegant. Hmm, I guess there isn't, but this should be possible to add. I'll stick in on my enormous TODO list. As a sidebar CodedInputStream is a bit of misnomer IMHO since it doesn't extend InputStream and have the usual stream handling facilities you would expect of a class with that name. The name was chosen to correspond to the C++ class of the same name. Oh well. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Serialization time in C++ using protobuf
I used protobuf to serialize an object in C++. The size of binary was around 300 KB and time taken was 1359.4098 milliseconds. I wonder why it took so much of time at C++ , where as, at java side - serialization of similar object took 39.62626263 milliseconds. I've seen SerializeToOSteam took around 1.28 seconds of the time in case of C++. I'm i missing something? Any pointers to this would be highly appreciated. Thanks, Shirish --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Re: Serialization time in C++ using protobuf
First, are you using: option optimize_for = SPEED; ? If not, add that line to your .proto file. But even without that option, the speed shouldn't be that slow. Maybe you can run in a profiler to see what's taking so long? Are you writing to an in-memory buffer or some sort of output stream? Is it possible that the stream is blocking? For reference, most of my C++ serialization benchmarks get around 250-500 MB/s with optimize_for = SPEED and 15-25 MB/s without it. On Wed, Mar 18, 2009 at 10:24 PM, ShirishKul shirish...@gmail.com wrote: I used protobuf to serialize an object in C++. The size of binary was around 300 KB and time taken was 1359.4098 milliseconds. I wonder why it took so much of time at C++ , where as, at java side - serialization of similar object took 39.62626263 milliseconds. I've seen SerializeToOSteam took around 1.28 seconds of the time in case of C++. I'm i missing something? Any pointers to this would be highly appreciated. Thanks, Shirish --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---