Hey Oliver, I figured it out just a minutes before your reply.
Thanks anyway Cheers, -Vinay On Dec 1, 2:28 pm, Oliver Jowett <oliver.jow...@gmail.com> wrote: > On Thu, Dec 1, 2011 at 3:22 PM, Vinay Bansal <vinsalw...@gmail.com> wrote: > > void write() { > > int fd = open("myfile", O_WRONLY), O_APPEND); > > google::protobuf::io::ZeroCopyOutputStream *out = new > > google::protobuf::io::FileOutputStream(fd); > > google::protobuf::io::GzipOutputStream *gzipOut = new > > google::protobuf::io::GzipOutputStream(out, options); > > google::protobuf::io::CodedOutputStream *codedOut = new > > google::protobuf::io::CodedOutputStream(gzipOut); > > codedOut->WriteVarint32(message.ByteSize()); > > message.SerializeToCodedStream(codedOut); > > close(fd); > > } > > If you're doing that for every (small) message, then the compressor is > never going to have a good chunk of data to work with; the compression > dictionary will be reset for every message, plus a gzip header gets > written each time. (For comparison, try a command-line gzip of a file > containing only a single message - that's essentially what you're > doing here) > > You want to open the file once, create one GzipOutputStream, then > write many messages to it. > > Oliver -- 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.