Comparing 2 PBs?

4,196 views
Skip to first unread message

ojwl...@googlemail.com

unread,
Oct 1, 2008, 12:13:31 PM10/1/08
to Protocol Buffers
What's the "best" (simplest, fastest) way to compare two protocol-
buffer objects? (in compiled_for=speed mode)

Kenton Varda

unread,
Oct 1, 2008, 4:21:26 PM10/1/08
to ojwl...@googlemail.com, Protocol Buffers
In which language?  In Java you can just use .equals().  In C++, you could serialize the two and compare the bytes.  Alternatively, you could write some code that iterates over the fields via reflection and compares them.

Chris

unread,
Oct 2, 2008, 3:26:01 PM10/2/08
to ojwl...@googlemail.com, Protocol Buffers
ojwl...@googlemail.com wrote:
> What's the "best" (simplest, fastest) way to compare two protocol-
> buffer objects? (in compiled_for=speed mode)
In what language?

In the Haskell implementation, it adds
> deriving (P'.Show, P'.Eq, P'.Ord, P'.Typeable)
to each message and this gives you printing, (==),(>),(<), etc.


Reply all
Reply to author
Forward
0 new messages