Commit f44242e
irheart
about_lists: pop(0) vs popleft() in 2vs3
I've looked for information on this note and haven't been able to find
anything of the sort.
A brief test in Py3.4.1 also indicates that list.pop(0) vs
deque.popleft() performance in Py3 is consistent with Py2.
>>> import timeit
>>> timeit.timeit('''x = list(range(100000))
while x:
x.pop(0)
''', number = 100)
385.9676046228002
>>> timeit.timeit('''x = deque(range(1000000))
while x:
x.popleft()
''', setup = 'from collections import deque', number = 100)
17.60678198131391 parent 7708336 commit f44242e
1 file changed
+1
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | | - | |
0 commit comments