I would suggest that the discrepancy is due to the fact that you build lists and arrays in e , whereas you only create lists in d . Consider:
import numpy as np def d(): a = [1,2,3,4,5] b = [10,20,30,40,50] c = [i*j for i,j in zip(a,b)] return c def e(): a = np.array([1,2,3,4,5]) b = np.array([10,20,30,40,50]) c = a*b return c
Here the functions f and g avoid re-creating lists / arrays every time, and we get very similar performance:
1.53083586693 15.8963699341 1.33564996719 1.69556999207
Note that list-comp + zip still wins. However, if we make the arrays large enough, numpy wins hands down:
t1 = [1,2,3,4,5] * 100 t2 = [10,20,30,40,50] * 100 t3 = np.array(t1) t4 = np.array(t2) print timeit.timeit('f(t1,t2)','from __main__ import f,t1,t2',number=10000) print timeit.timeit('g(t3,t4)','from __main__ import g,t3,t4',number=10000)
My results:
0.602419137955 0.0263929367065