b.mask[498] = True
t = timeit.Timer(
    'c=b.view(np.ndarray)[~b.mask[:,0]]; np.apply_along_axis(test, 1, c)',
    'from __main__ import test, b, ma, np')
print(round(t.timeit(100), 6))
Python/Numpy - Masked Arrays are Very Slow