[Numpy-discussion] Numpy Benchmarking (original) (raw)

Travis Oliphant oliphant.travis at ieee.org
Tue Jun 27 20:24:23 EDT 2006


Dennis V. Perepelitsa wrote:

Hi, all.

I've run some benchmarks comparing the performance of scipy, numpy, Numeric and numarray vs. MATLAB. There's also the beginnings of a benchmark framework included. The results are online at: http://web.mit.edu/jonas/www/bench/ They were produced on a Thinkpad T42 with an Intel Pentium M 1.7GHz processor running Ubuntu Dapper Drake (6.06). All the languages/packages were built from source, and, in the case of numpy and scipy, linked to ATLAS. Each datapoint represents the arithmetic mean of ten trials. I agree with Robert that a minimum would be a better way to aggregate results.

The results have some interesting implications. For example, numpy and scipy perform approximately the same except when it comes to matrix inversion, MATLAB beats out all the Python packages when it comes to matrix addition, and numpy seems to be beaten by its predecessors in some cases. Why is this the case? In terms of creating zeros matrices, you are creating double-precision matrices for NumPy but only single-precision for Numeric and numarray.

Try using numpy.float32 or 'f' when creating numpy arrays. The float is the Python type-object and represents a double-precision number. Or, if you are trying to use double precision for all cases (say for comparison to MATLAB) then use 'd' in numarray and Numeric.

For comparing numpy with numarray and Numeric there are some benchmarks in the SVN tree of NumPy under benchmarks.

These benchmarks have been helpful in the past in pointing out areas where we could improve the code of NumPy, so I'm grateful for your efforts.

-Travis



More information about the NumPy-Discussion mailing list