def test_time(size, stop):
        count = sum(size**i for i in range(stop+1))
        yield 'count', count

        def wrap_testing(name, tester):
            print(name, end='')
            start = time()
            counter = 0
            while time() - start < 1 or counter < 10:
                counter+=1
                tester()
            end = time()
            print()
            result = 1000 * (end - start) / counter
            print('{0:.3f} milliseconds per {1}'.format(result, name))

            yield name, result

        print('Initialization [{0}-{1}] {2}'.format(size, stop, count))
        tree = createNode(size, stop)

        def test_serialize():
            tree.serialize(bytearray())

        def test_deserialize(ba):
            Node.deserialize(ba)

        def test_dumps():
            pickle.dumps(tree, 2)

        def test_loads(data):
            pickle.loads(data)


        ba = bytearray()
        tree.serialize(ba)
        data = pickle.dumps(tree, 2)

        tests = (
            ('serialize', test_serialize),
            ('deserialize', partial(test_deserialize, ba)),
            ('pickle.dumps', test_dumps),
            ('pickle.loads', partial(test_loads, data)),
            )

        for name, tester in tests:
            for _ in wrap_testing(name, tester):
                yield _
dataset/ETHPy150Open Evgenus/protocyt/protocyt/examples/benchmark/main.py/test_time/original