[protobuf] Performance analysis of RepeatedField versus generated class

2010-08-17 Thread nirajshr
I want to know which of the following implementation is better in terms of performance and usability. Option A is much easier and portable across different protobuf versions. Is it worth the trouble trying to go with Option B? In my tests, I could not find much of a performance gain by using

Re: [protobuf] Performance analysis of RepeatedField versus generated class

2010-08-17 Thread Kenton Varda
Option B avoids an extra copy of the data. It should work with all versions of protocol buffers. Use it if profiling shows a lot of time spent in this code, otherwise use whichever version you find easier to follow. On Tue, Aug 17, 2010 at 8:51 AM, nirajshr niraj...@gmail.com wrote: I want to

Re: [protobuf] Performance analysis of RepeatedField versus generated class

2010-08-17 Thread Kenton Varda
BTW On Tue, Aug 17, 2010 at 8:51 AM, nirajshr niraj...@gmail.com wrote: repeated DoubleData bucketDouble = 2; You should declare this field packed: repeated DoubleData bucketDouble = 2 [packed=true]; This will improve efficiency on the wire. -- You received this message because you

Re: [protobuf] Performance analysis of RepeatedField versus generated class

2010-08-17 Thread Daniel Wright
How about this way-more-readable variant of option B: add_double_vector(deal_pb.bucket(i).bucketdouble().data(), deal_pb.bucket(i).bucketdouble().size()); This assumes that add_bouble_vector only needs a const pointer. If it needs a non-const pointer, add the