INL/BlackLab

Use parallelQuickSort() to sort Hits as well?

Opened this issue · 0 comments

IntArrays.parallelQuickSort() really sped up sorting terms while writing them to disk or while reconstructing the global terms list.

Sorting hits by a HitProperty seems to still be done single-threaded in the HitsInternal* classes. We should test if using parallelQuickSort() speeds this up. This method will fall back to regular quickSort() if there's fewer than 8192 elements, so should always be faster.

The only way it could actually end up being slower is if any locking occurs. For example, Collator.compare() is a synchronized method, so using that in a Comparator will slow down parallel sorts by a lot (confirmed using the TestSortPerformance utility). This could be counteracted by precalculating a value that can be compared without locking (a CollationKey in this example).