[Numpy-discussion] Numpy Benchmarking

Robert Kern robert.kern at gmail.com
Tue Jun 27 18:50:19 CDT 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 have two suggestions based on a two-second glance at this:

1) Use time.time() on UNIX and time.clock() on Windows. The usual snippet of 
code I use for this:

import sys
import time
if sys.platform == 'win32':
     now = time.clock
     now = time.time

t1 = now()
t2 = now()

2) Never take the mean of repeated time trials. Take the minimum if you need to 
summarize a set of trials.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the Numpy-discussion mailing list