In this case, you can improve the performance even slightly further by unrolling the logic within markDistinctHash to not create the marker block, but instead directly append the proper tuples to the output blockbuilder.