[ create a new paste ] login | about

Link: http://codepad.org/E8hZqFXG    [ raw code | output | fork ]

aaronla - Python, pasted on Sep 4:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# less_slow.py

import time
from random import shuffle
a = [i for i in range(300000)]
shuffle(a)

a.sort(key=id)

sum = 0
t1 = time.time()
for i in a:
    sum = sum + i
t2 = time.time()
print t2-t1


Output:
1
0.265678882599


Create a new paste based on this one


Comments: