Skip to content

Instantly share code, notes, and snippets.

@suzaku
Created September 13, 2015 08:11
Show Gist options
  • Save suzaku/d784b810161cde64f053 to your computer and use it in GitHub Desktop.
Save suzaku/d784b810161cde64f053 to your computer and use it in GitHub Desktop.
In [74]: timeit.timeit(stmt='del dll[10000]', setup='from collections import deque;dll = deque(range(10**5))', number=100)
Out[74]: 0.002535041014198214
In [75]: timeit.timeit(stmt='del l[10000]', setup='l = list(range(10**5))', number=100)
Out[75]: 0.006009762000758201
@bcho
Copy link

bcho commented Sep 13, 2015

Python 3.4.3 (default, Jul 26 2015, 16:49:00)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin

>>> timeit.timeit(stmt='del l[10000]', setup='l = list(range(10**7))', number=100)
0.943889683985617
>>> timeit.timeit(stmt='del dll[10000]', setup='from collections import deque;dll = deque(range(10**7))', number=100)
0.0009256399935111403

@suzaku
Copy link
Author

suzaku commented Sep 13, 2015

0.943889683985617 > 0.0009256399935111403

and

0.006009762000758201 > 0.002535041014198214

What's wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment