[Numpy-discussion] Numeric3 and speed of new-style classes

Travis Oliphant oliphant at ee.byu.edu
Thu Feb 3 13:31:26 EST 2005

I fixed a major oversight in Numeric3 and now it works pretty well (it 
is basically old Numeric with a bunch of new types, no math (yet)), 
using new-style classes, and some checks for alignment when 
dereferencing data.

I did some simple array creation timing tests.  An example of the 
results is given below.  The bottom line is that new-style classes do 
nothing but speed up (a little bit) basic object creation. 


First test (Numeric3):    .196081876755

import sys

import time

import multiarray

start = time.time()
for k in range(100000):
    g = multiarray.arraytype((4,3),'d')
print time.time() - start

Second test (Numeric):  .203589916229

import Numeric
import time

start = time.time()
for k in range(100000):
    g = Numeric.empty((4,3),'d')
print time.time() - start

More information about the NumPy-Discussion mailing list