Lets at least add an `if isinstance(x, MaskedArray):` to avoid the `np.ma.asarray` in that case. The conversion seems quite slow (though that special case could probably be also optimized in `ma.asarray`).