def testDecodeRepeatedFields(self):

    repeats = self.REPEATS / 50
    s = jobs_pb2.MessageList()
    for i in range(self.REPEATS):
      s.job.add(session_id="test", name="foobar", request_id=i)

    test_data = s.SerializeToString()

    def ProtoDecode():
      s = jobs_pb2.MessageList()
      s.ParseFromString(test_data)

      self.assertEqual(s.job[100].request_id, 100)

    def SProtoDecode():
      s = FastGrrMessageList(test_data)
      self.assertEqual(s.job[100].request_id, 100)

    self.TimeIt(SProtoDecode, "SProto Repeated Decode",
                repetitions=repeats)

    self.TimeIt(ProtoDecode, "Protobuf Repeated Decode",
                repetitions=repeats)
Test decoding of repeated fields.
dataset/ETHPy150Open google/grr/grr/lib/rdfvalues/benchmark_test.py/RDFValueBenchmark.testDecodeRepeatedFields