import pyperf import _testcapi runner = pyperf.Runner() runner.bench_time_func('bytearray', _testcapi.bench_bytearray) runner.bench_time_func('byteswriter', _testcapi.bench_writer)