'Test decoding performance.'

def testDecode(self):

    s = jobs_pb2.GrrMessage(name=u'foo', request_id=1, response_id=1, session_id=u'session')
    data = s.SerializeToString()
    def ProtoDecode():
        new_s = jobs_pb2.GrrMessage()
        new_s.ParseFromString(data)
        self.assertEqual(new_s.session_id, 'session')
        self.assertEqual(new_s.session_id.__class__, unicode)
    def RDFStructDecode():
        new_s = StructGrrMessage()
        new_s.ParseFromString(data)
        self.assertEqual(new_s.session_id, 'session')
        self.assertEqual(new_s.session_id.__class__, unicode)
    self.TimeIt(RDFStructDecode)
    self.TimeIt(ProtoDecode)
