Closed GoogleCodeExporter closed 9 years ago
Your example triggers broadcasting of 'b', something which numexpr
traditionally hasn't been good at. Using the newiter branch of numexpr, which
takes advantage of features in NumPy 1.6 (which should have a release candidate
soon), I get numexpr performing better:
In [4]: np.__version__
Out[4]: '2.0.0.dev-be364f7'
In [5]: ne.__version__
Out[5]: '2.0.dev290'
In [6]: a = np.random.random((3550, 8000))
In [7]: b = array(a[0])
In [8]: %timeit ne.evaluate('a - b')
1 loops, best of 3: 214 ms per loop
In [9]: %timeit a-b
1 loops, best of 3: 308 ms per loop
In [10]: ne.set_num_threads(1)
Out[10]: 2
In [11]: %timeit ne.evaluate('a - b')
1 loops, best of 3: 291 ms per loop
With one thread, since the expression is just one operation, I would expect
numexpr and numpy to perform the same, but it looks like numpy needs some more
performance work. In general, more complex expressions are what numexpr will
evaluate much faster than numpy.
Original comment by mwwi...@gmail.com
on 27 Apr 2011 at 5:51
The nditer branch has been merged into default, and I'm getting reasonable
performance differences between numexpr and numpy. Can you confirm on your
system?
Original comment by mwwi...@gmail.com
on 30 Oct 2011 at 11:51
Original issue reported on code.google.com by
wkerzend...@gmail.com
on 30 Mar 2011 at 5:27