filter: small optimisation, using array access is a bit faster
than updating the pointers all the time
filter: use array access even when not compiling with optimisation