ENH: improved, faster algorithm for array padding

New padding method scales much better with dimensionality. The new
implementation is fully vectorized, building each abstracted
n-dimensional padding block in a single step and taking advantage
of separability. The API is completely preserved, and the old
algorithm is used if a vector function is input for `mode`.

The new algorithm is faster for all tested combinations of inputs,
and scales much better with dimensionality. Execution time reductions
from ~25% for small rank 1 arrays to >99% for rank 4+ arrays observed.