Optimizing zeroing patterns