On 20 March 2014 06:10, <[email protected]> wrote: > Oh yes you are right. There was a mistake in my calculation. > > Well I'll try without the submessage. The count of docid and of score is > always the same. So there is no Problem for me. > > But it's sad that java takes around 2 seconds to send the Message to the > server, recieve the Response and display the response. > And C++ takes 20-25 seconds only for this function call > "srchResp.ParseFromCodedStream(&codedIn);" :( > I don't think that changing the message will get me around 20 seconds :( Too > bad.
If you man many things that need to be read into the repeated field, maybe your memory allocator is running into trouble when resizing the message all the time ? Since the repeated field does not know beforehand how many objects are coming, it is forced to re-allocate while parsing. Just re-use the message object, as it can make use of the memory already allocated. Create one C++ object, then use that to parse from stream. When you're done with it, re-use the same object for subsequent parse. I think it is possible to somehow tell the repeated field beforehand to reserve some capacity (similar to a vector<T>), but don't know that right now. -h > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
