Skip to content

Instantly share code, notes, and snippets.

@blipp
Created March 8, 2016 22:09
Show Gist options
  • Save blipp/e11007511fd66bb0563a to your computer and use it in GitHub Desktop.
Save blipp/e11007511fd66bb0563a to your computer and use it in GitHub Desktop.
List performance in Sage (Python)
n = 140000
L = []
start = cputime()
for i in range(n):
L = L + [i]
diff = cputime(start)
print diff
L = []
start = cputime()
for i in range(n):
L.append(i)
diff = cputime(start)
print diff
sage: runfile list.sage
60.316661
0.02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment