Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. import asyncio
  2. import time
  3.  
  4.  
  5. async def coro():
  6. await asyncio.sleep(0)
  7.  
  8. async def main(loop, coros):
  9. start = loop.time()
  10. for i in range(coros):
  11. await coro()
  12. dt = loop.time() - start
  13. print("Coros per second: {}, load: {}".format(coros/dt, loop.load()))
  14.  
  15. loop = asyncio.get_event_loop()
  16. loop.run_until_complete(main(loop, 400000))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement