Use masked arrays after checking that it performs equally.