We are using protobuf as our messaging, and each message, we loop thru the
set fields, and do something with it.
We loop it using
for ( final Map.Entry<Descriptors.FieldDescriptor, Object> entry :
FieldDescriptor field = entry.getKey();
Object value = entry.getValue();
Under profiler, we found that this GetAllFields uses most of the time, and
I did some research, and it looks like there is no other way.
I know that we can use do something like this:
for ( final FieldDescriptor field : msg.getDescriptorForType().getFields())
Object value = message.getField(field);
But getDescriptorForType returns all the fields rather than just the set
Does anyone know of another better performing way to loop thru the fields?
I believe the problem with getAllFields are creating a new map each time,
and also reflection. Can i force it to use Trove map inside rather than a
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 post to this group, send email to email@example.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.