|
From: Paulo J. S. S. <pjs...@im...> - 2006-01-19 12:57:54
|
Hello, I am sending an update benchmark table below. I have noticed that in my benchmarck code for numpy I was using transpose(A) instead of A.transpose() which introduces an extra function call. A very big penalty for tiny matrices. Now the transpose operation doesn't look that bad in numpy when compared to matlab. There is still something on this table that I can't understand. Why are the index operations so expensive in domension 50? If you look closely you'll see that numpy is faster in dimension 5, much slower in dimension 50 (2.6 times slower) and then the gap decreases in dimension 500 (1.6 slower). Best, Paulo Tests x.T*y x*y.T A*x A*B A.T*x half 2in2 Dimension: 5 Array 0.82 0.22 0.18 0.26 0.33 0.90 1.07 Matrix 4.54 1.41 0.56 0.66 0.99 2.87 4.34 NumArr 2.82 0.66 0.61 0.71 7.54 6.61 10.56 Numeri 1.15 0.34 0.28 0.38 0.66 0.60 0.71 Matlab 1.60 0.39 0.31 0.33 0.35 1.13 0.91 Dimension: 50 Array 9.03 1.95 0.48 16.60 0.98 3.89 4.07 Matrix 45.94 3.55 0.90 17.30 1.67 5.93 7.42 NumArr 29.18 2.47 0.90 18.23 11.86 7.87 11.88 Numeri 11.91 2.13 0.59 17.21 9.27 0.93 3.02 Matlab 16.12 1.81 0.99 16.28 0.70 1.46 1.66 Dimension: 500 Array 1.09 8.05 1.77 151.32 1.89 3.63 3.86 Matrix 4.87 8.16 1.82 151.44 1.94 4.22 4.35 NumArr 3.12 8.19 1.80 151.66 19.83 3.94 5.30 Numeri 1.43 8.18 1.81 151.68 17.52 2.94 4.08 Matlab 1.91 5.07 1.89 150.52 1.84 2.27 2.74 |