numpy/numpy — pull request #4060 by larsmans (2013-11-17 14:52:32+00:00)
Title: MAINT: always do aligned reads in count_boolean_trues fast path

Update to #4057: instead of doing unaligned reads when permitted (i.e. on x86), always do aligned reads. This means that the same path is executed regardless of the platform.

Timings on an AMD64 box show no speed difference compared to the previous version by @juliantaylor. Before:

```
>>> a = np.ones(200000., dtype=np.bool)
>>> %timeit np.count_nonzero(a)
10000 loops, best of 3: 43.7 us per loop
>>> %timeit np.count_nonzero(a[1:])
10000 loops, best of 3: 48.6 us per loop
```

With this PR:

```
>>> a = np.ones(200000., dtype=np.bool)
>>> %timeit np.count_nonzero(a)
10000 loops, best of 3: 44 us per loop
>>> %timeit np.count_nonzero(a[1:])
10000 loops, best of 3: 47.9 us per loop
```

(I picked a large array size because timings on a 20000-element array varied quite a bit.