Skip to content

Instantly share code, notes, and snippets.

@pfreixes
Last active August 20, 2017 22:53
Show Gist options
  • Save pfreixes/233fd8c6a6ec82f2cde4688a2976bf2d to your computer and use it in GitHub Desktop.
Save pfreixes/233fd8c6a6ec82f2cde4688a2976bf2d to your computer and use it in GitHub Desktop.
import asyncio
import time
async def coro():
await asyncio.sleep(0)
async def main(loop, coros):
start = loop.time()
for i in range(coros):
await coro()
dt = loop.time() - start
print("Coros per second: {}".format(coros/dt))
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop, 400000))
@pfreixes
Copy link
Author

paufreixes@ ~/pfreixes/cpython (load) $ ./python.exe ../test_load_overhead.py
Coros per second: 29601.8352714535
paufreixes@ ~/pfreixes/cpython (master) $ ./python.exe ../test_load_overhead.py
Coros per second: 30707.975008548827

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment