Thanks for your quick response. This really helps :-) Regards, Prakash
On Aug 11, 8:25 pm, Josh Hartman <atomicfo...@gmail.com> wrote: > I have code ready for the compiler to do just this. Please > seehttp://github.com/jhartman/Google-Protocol-Buffers/tree/java-optimiza... > > I need to clean up and benchmark the code for using apache primitives to > store the repeated primitive fields. I'll try to finish it this week and > post it to the mailing list. > > Thanks, > Josh H > > On Wed, Aug 11, 2010 at 7:40 AM, Prakash Rao <prakashrao1...@gmail.com>wrote: > > > > > I'm also looking for proper ways to set initial capacity for my > > repeatable fields (in protobuf java 2.3.0). Is this possible without > > hacking the generated code? > > > Regards, > > Prakash > > > On Jul 1, 3:09 am, Josh Hartman <atomicfo...@gmail.com> wrote: > > > Good catch. This was the problem and the fix results in a speedup of > > about > > > 70% all the way from serializing 1000 elements to 1,000,000 elements in > > an > > > int array. I'll throw my changes up on github this evening. > > > > Instead of doing an empty check, I just do a reference check against > > > Collections.EMPTY_LIST. > > > > Thanks, > > > Josh > > > > On Wed, Jun 30, 2010 at 2:24 PM, Evan Jones <ev...@mit.edu> wrote: > > > > On Jun 29, 2010, at 17:49 , Josh Hartman wrote: > > > > >> "public Builder ensure$capitalized_name$Capacity(int > > minCapacity) > > > >> {\n" > > > >> " if (result.$name$_.isEmpty()) {\n" > > > >> " result.$name$_ = new > > > >> java.util.ArrayList<$boxed_type$>(minCapacity);\n" > > > > > I think the problem is that in the empty case, the next call to add* > > will > > > > re-create the ArrayList as empty, which defeats the call to > > ensureCapacity. > > > > Try hacking something in that method to make this work (check the > > type?) > > > > > Evan > > > > > -- > > > > Evan Jones > > > >http://evanjones.ca/-Hide quoted text - > > > > - Show quoted text - > > > -- > > You received this message because you are subscribed to the Google Groups > > "Protocol Buffers" group. > > To post to this group, send email to proto...@googlegroups.com. > > To unsubscribe from this group, send email to > > protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/protobuf?hl=en.- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@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.