Created
November 25, 2011 01:30
-
-
Save qoelet/1392608 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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