quicksort optimizations