import pyperf import _testcapi runner = pyperf.Runner() data = list(range(10**5)) runner.bench_time_func('incref', _testcapi.bench_incref, data, inner_loops=len(data))