Re: [protobuf] File size of the serialized records

2010-03-22 Thread Jason Hsueh
If you're measuring using sizeof(), you won't account for memory allocated by subobjects (strings and submessages are stored as pointers). You should use Message::SpaceUsed() instead. The inmemory vs serialized size is going to depend on your proto definition and how you use it. If you have a lot

Re: [protobuf] File size of the serialized records

2010-03-22 Thread Vinit Mahedia
Hi Jason, Thanks for the quick reply. I am not surprised by the increase in file size, But I am under impression that If I insert the same record thousand times, the size of file should be large accordingly, e.g, assume that one record generates the file of size 32 bytes; with1024 records

Re: [protobuf] File size of the serialized records

2010-03-22 Thread Daniel Wright
The most likely cause is a bug in your code where there's something you aren't clearing each time you write a record, so at each iteration in your loop, the record you're writing is getting bigger. Of course I can't say for sure without seeing the code. Daniel On Mon, Mar 22, 2010 at 1:13 PM,

Re: [protobuf] File size of the serialized records

2010-03-22 Thread Vinit Mahedia
I am using add_person.cc provided in the sample file. The only change I have done is, a while loop around this code. So it's same record inserted multiple times. // Write the new address book back to disk.fstream output(argv[1], ios::out | ios::trunc | ios::binary); *int nRecords = 10;*

Re: [protobuf] File size of the serialized records

2010-03-22 Thread Kenton Varda
That's not the right way to write multiple records. What you're doing is writing multiple address books without proper boundaries between them. The right thing to do would be to add multiple persons to one address book, then write it once. That said, the file produced by your code should grow