[Numpy-discussion] Interesting timing results

Sasha ndarray at mac.com
Tue Jan 17 14:27:05 CST 2006


> python -m timeit -s "x=bool(0)" "x or x"
10000000 loops, best of 3: 0.111 usec per loop
> python -m timeit -s "from numpy import bool_, logical_or as or_; x=bool_(0)" "or_(x, x)"
100000 loops, best of 3: 3.25 usec per loop

Numpy is 32x slower than python -- not very good.

Interestingly,

> python -m timeit -s "from numpy import bool_; x=bool_(0)" "x or x"
1000000 loops, best of 3: 0.388 usec per loop

-- sasha




More information about the Numpy-discussion mailing list