Replica of default python timeit module with small changes to allow async functions and await keyword.
All CLI options should work as same from the original module. Taken from this exact commit.
$python timeit.py -n 5 -r 5 -s "import asyncio" 'await asyncio.sleep(2)'
5 loops, best of 5: 2 sec per loop
$python timeit.py -n 5 -r 5 -s "import asyncio" 'await asyncio.sleep(2)
await asyncio.sleep(2)'
5 loops, best of 5: 4 sec per loop
$python timeit.py -n 5 -r 5 -s "import asyncio" 'await asyncio.gather(asyncio.sleep(2),asyncio.sleep(2))'
5 loops, best of 5: 2 sec per loop
This is not extensively tested. Also unsure if timeit can be reliably used for async code.
All original python library code is under PSF's original license. Any of my contributions are under Apache 2.0