Skip to content

Instantly share code, notes, and snippets.

@woosungchu
Last active August 4, 2022 14:16
Show Gist options
  • Save woosungchu/62aa2a3db8a8d93abcf92c501d69a886 to your computer and use it in GitHub Desktop.
Save woosungchu/62aa2a3db8a8d93abcf92c501d69a886 to your computer and use it in GitHub Desktop.
Do you think you know recursive function and asyncio?
import asyncio
import time
def recur(depth):
depth -= 1
print('recursion in', depth)
for ea in [1,2,3,4,5]:
if depth>0:
recur(depth)
def main():
recur(8)
start = time.time()
print(f'Time: {time.time() - start:.2f}')
main()
end = time.time()
print(f'Time: {end-start:.2f} sec')
@woosungchu
Copy link
Author

woosungchu commented Aug 4, 2022

it will cost 10 seconds

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