[Numpy-discussion] Slicing slower than matrix multiplication?

Francesc Alted faltet@pytables....
Mon Dec 14 10:22:40 CST 2009

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.

Francesc Alted

More information about the NumPy-Discussion mailing list