Skip to content

Instantly share code, notes, and snippets.

@qoelet
Created November 25, 2011 01:30
Show Gist options
  • Save qoelet/1392608 to your computer and use it in GitHub Desktop.
Save qoelet/1392608 to your computer and use it in GitHub Desktop.
import time
from collections import deque
def normal_list(d):
start = time.time()
r = []
for i in d:
r.append(i)
end = time.time()
print "normal:"
print end - start
def deque_list(d):
start = time.time()
r = deque()
for i in d:
r.append(i)
end = time.time()
print "deque:"
print end - start
if __name__ == '__main__':
d = [4] * 100000000
normal_list(d)
deque_list(d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment