(i5 ivybridge cpu windows 10) Map seems to come out slower every time, for what is a very long list, where it should do well
import time
l = [2049 for i in range(20000000)]
def f(e):
return (e * 2) - 56
st = time.time()
l = list(map(f,l))
end = time.time()
print ("map: "+str(end-st))
l = [2049 for i in range(20000000)]
st = time.time()
l = [f(e) for e in l]
end = time.time()
print ("list comp: "+str(end-st))
prints:
map: 4.037442207336426
list comp: 3.9109268188476562