Optimization of the void matrix builder