-
-
Save rootmos/feb5917c0991b54d24290bb16edd7739 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
def fib(n): | |
if n <= 2: | |
return 1 | |
else: | |
return fib(n-1) + fib(n-2) | |
print fib(45) | |
# > /usr/bin/time ./fib.py | |
# 1134903170 | |
# 226.28user 0.03system 3:46.92elapsed 99%CPU (0avgtext+0avgdata 6848maxresident)k | |
# 0inputs+0outputs (0major+928minor)pagefaults 0swaps | |
# > /usr/bin/time pypy fib.py | |
# 1134903170 | |
# 22.31user 0.00system 0:22.33elapsed 99%CPU (0avgtext+0avgdata 79600maxresident)k | |
# 0inputs+0outputs (0major+10265minor)pagefaults 0swaps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment