Created
January 26, 2016 21:38
-
-
Save bast/1bd41989a975a999d653 to your computer and use it in GitHub Desktop.
Memory profiling example.
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
def gauss1(n): | |
j = 0 | |
for i in range(1, n+1): | |
j += i | |
return j | |
def gauss2(n): | |
j = 0 | |
for i in xrange(1, n+1): | |
j += i | |
return j | |
n = 10**5 | |
print(gauss1(n)) | |
print(gauss2(n)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment