[Numpy-discussion] best way of speeding up a filtering-like algorithm