[Numpy-discussion] Slicing slower than matrix multiplication?

Jasper van de Gronde th.v.d.gronde at hccnet.nl
Mon Dec 14 12:20:32 EST 2009


Francesc Alted wrote:
> A Monday 14 December 2009 17:09:13 Francesc Alted escrigué:
>> The things seems to be worst than 1.6x times slower for numpy, as matlab
>> orders arrays by column, while numpy order is by row.  So, if we want to
>> compare pears with pears:
>>
>> For Python 600x200:
>>    Add a row: 0.113243 (1.132425e-05 per iter)
>> For Matlab 600x200:
>>    Add a column: 0.021325 (2.132527e-006 per iter)
> 
> Mmh, I've repeated this benchmark on my machine and got:
> 
> In [59]: timeit E + Xi2[P/2]
> 100000 loops, best of 3: 2.8 µs per loop
> 
> that is, very similar to matlab's 2.1 µs and quite far from the 11 µs you are 
> getting for numpy in your machine...  I'm using a Core2 @ 3 GHz.

I'm using Python 2.6 and numpy 1.4.0rc1 on a Core2 @ 1.33 GHz 
(notebook). I'll have a look later to see if upgrading Python to 2.6.4 
makes a difference.




More information about the NumPy-Discussion mailing list