Fixed performance issues with SortInsertActions for large batches.