Skip to content

Instantly share code, notes, and snippets.

@bast
Created January 26, 2016 21:38
Show Gist options
  • Save bast/1bd41989a975a999d653 to your computer and use it in GitHub Desktop.
Save bast/1bd41989a975a999d653 to your computer and use it in GitHub Desktop.
Memory profiling example.
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