Here is a quick-n-dirty masked array version of broadcast_arrays(). It is very efficient and very clean and easy to understand.

```
def ma_broadcast_arrays(*arrays):
    arrays = [np.ma.masked_array(x) for x in arrays)]
    broadcasted = np.broadcast_arrays(*arrays)
    broadcasted_masks = np.broadcast_arrays(*[x.mask for x in arrays])
    return [np.ma.masked_array(x, mask=mask) for x, mask in zip(broadcasted, broadcasted_masks)]
```
The beauty of the above function is that the inputs can be heterogenous (scalars, regular numpy arrays, masked arrays), and everything comes out at the end as broadcasted views of masked arrays so there is little if any copies.

Then, you can use cbook.delete_masked_points() to get rid of anything masked, so you don't have to worry about making the mask the same across all arrays.