'Test decoding performance.
This benchmarks the lazy decoding feature where a large protobuf is decoded
but only a few fields are examined.'

def testDecode2(self):

    s = knowledge_base_pb2.User(**self.USER_ACCOUNT)
    data = s.SerializeToString()
    def ProtoDecode():
        new_s = knowledge_base_pb2.User()
        new_s.ParseFromString(data)
        self.assertEqual(new_s.username, 'user')
        self.assertEqual(new_s.username.__class__, unicode)
    def RDFStructDecode():
        new_s = rdf_client.User()
        new_s.ParseFromString(data)
        self.assertEqual(new_s.username, 'user')
        self.assertEqual(new_s.username.__class__, unicode)
    self.TimeIt(RDFStructDecode)
    self.TimeIt(ProtoDecode)
