In the course of trying to speed up matplotlib, I did a little
experiment that may indicate a place where numpy can be sped up: the
creation of a 2-D array from a list of tuples. Using the attached
script, I find that numarray is roughly 5x faster than either numpy or
Numeric:
[efiring@manini tests]$ python test_array.py
array size: 10000 2
number of loops: 100
numpy 10.89
numpy2 6.57
numarray 1.77
numarray2 0.76
Numeric 8.2
Numeric2 4.36
[efiring@manini tests]$ python test_array.py
array size: 100 2
number of loops: 100
numpy 0.11
numpy2 0.06
numarray 0.03
numarray2 0.01
Numeric 0.08
Numeric2 0.05
The numarray advantage persists for relatively small arrays (100x2;
second example) and larger ones (10000x2; first example). In each case,
the second test for a given package (e.g., numpy2) is the result with
the type of the array element specified in advance, and the first (e.g.,
numpy) is without such specification.
The versions I used are:
In [3]:Numeric.__version__
Out[3]:'24.0b2'
In [5]:numarray.__version__
Out[5]:'1.4.1'
In [7]:numpy.__version__
Out[7]:'0.9.9.2584'
Eric
|