RaghavaDhanya / async_timeit

Async version of python's timeit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Async Timeit

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.

Example usage

$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

Warning

This is not extensively tested. Also unsure if timeit can be reliably used for async code.

License

All original python library code is under PSF's original license. Any of my contributions are under Apache 2.0

About

Async version of python's timeit

License:Apache License 2.0


Languages

Language:Python 100.0%