For postprocess, one option would be to add a new c++ routine that only sorts specific rows.
Difficult to say if this is faster or equivalent to sorting in unique.