Compacting before sorting.