Areas of NumPy that have come up as possible slow points:
- PyArray?_EnsureArray. It seems to be slow for python ints. This came up as a possible culprit for some pow() slowness. PyArray?_EnsureArray could special-check Python scalars for a speed-up.
- Default (digits=0) case of around is 10x slower than (x+0.5).astype(int).astype(float). Resolved: changeset:2151 implements fast rint function and adds a round method to ndarray that is about as fast for digits=0 case.
- As of changeset:2173 x.fill(1) is 2x slower than x += 1. One should be able to set memory to a constant value faster than autoincrement. Discussion. Implemented in changeset:2188.
- As of changeset:2108 x.sum(0) is 5x slower than x + x for x = zeros((2,500), 'f'). Discussion
- As of changeset:2108 x.sum() is 2x slower than add.reduce(x) for small arrays.
- pixels[:,:,:] = r, g, b is 20x slower than copying from another large array. pixels = zeros((600, 600, 3), 'uint8'); r = g = b = 255