Last active
July 8, 2021 03:37
-
-
Save huytung228/bf97d30f26502e6c0f7359627d3e2cc5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
async def count(): | |
print("One") | |
await asyncio.sleep(1) | |
print("Two") | |
async def main(): | |
await asyncio.gather(count(), count(), count()) | |
if __name__ == "__main__": | |
import time | |
s = time.perf_counter() | |
asyncio.run(main()) | |
elapsed = time.perf_counter() - s | |
print(f"{__file__} executed in {elapsed:0.2f} seconds.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment