[Numpy-discussion] Numpy x Matlab: some synthetic benchmarks

Fernando Perez Fernando.Perez at colorado.edu
Wed Jan 18 14:52:08 CST 2006


David M. Cooke wrote:

> I've done a little bit of work along these lines. I have a module I
> call vector3 [*] which has 2- and 3-dimensional immutable vectors,
> using either ints or doubles. It's as fast as I could make it, while
> keeping it all written in Pyrex. I find it very convenient for
> anything vector-related. Konrad Hinsen has something similiar in the
> development version of his ScientificPython package.
> 
> [*] http://arbutus.mcmaster.ca/dmc/software/vector3.html
> 
> Also, I've also done some playing around with a n-dimensional vector
> type (restricted to doubles). My best attempts make it ~4-5x faster
> than numpy (and 2x faster than Numeric) for vectors of dimension 10
> on simple ops like + and *, 2x faster than numpy for dimension 1000,
> and approaching 1x as you make the vectors larger. Indexing is about
> 3x faster than numpy, and 1.4x faster than Numeric. So that gives I
> think some idea of the maximum speed-up possible.
> 
> I think the speedups mostly come from the utter lack of any
> polymorphism: it handles vectors of doubles only, and only as
> contiguous vectors (no strides).

This is excellent, thanks for the pointer.  I can see uses for vectors (still 
1-d, no strides, etc) with more than 3 elements, and perhaps fixed-size (no 
reshaping, no striding) 2-d arrays (matrices), but this looks like a good 
starting point.  Sandbox material?


Cheers,

f




More information about the Numpy-discussion mailing list