Comment #4 on issue 460 by [email protected]: Add isDefault() to Java
Message interface as a fast means to verify whether it is a default instance
http://code.google.com/p/protobuf/issues/detail?id=460
1. Call it isEmpty instead, fine. However, how would you efficiently check
whether a DynamicMessage, for instance, is empty? The only way is via
equals, not good. Also, this check is employed by Message.equals()
implementations, and instead of checking isDefault()/isEmpty(), it
does "message == message.getDefaultInstnaceForType()" and then defaults to
equals on 2 messages, so for an empty/default message in case of not
GeneratedMessage, it goes slow with Message.getAllFields equals()!
2. Consider how much performance can be squeezed here and how often this
happening.
3. And as I mentioned earlier quite a few times, it plain
painful/impossible to use the API for such a fundamental and fundamentally
simple case.
4. I worked for Google as a consultant for a year recently, so your point
is well taken, and it is precisely why I propose this. The API is so
tightly closed, it's VERY difficult to extend w/o much copy/paste and waste.
Hope this helps,
David
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.