SortingLab.jl icon indicating copy to clipboard operation
SortingLab.jl copied to clipboard

Insertion Sort to Finish Off Radix Sort?

Open ParadaCarleton opened this issue 4 years ago • 3 comments

For small arrays, insertion sort is more efficient, so handing off a mostly-sorted array to an insertion sort should give speedups. From what I can see, this isn't implemented yet (although I might have missed it).

ParadaCarleton avatar Jul 19 '21 21:07 ParadaCarleton

No it isn't. I think for smaller arrays, like size 12. That is implemented in base, so not that hard to copy the code over

xiaodaigh avatar Jul 19 '21 22:07 xiaodaigh

No it isn't. I think for smaller arrays, like size 12. That is implemented in base, so not that hard to copy the code over

I don't think it even needs to be copied, you could just hand off to the base sort!() function.

I think an array size of 32 or 16 is more likely to be optimal, but this should probably be benchmarked.

ParadaCarleton avatar Jul 20 '21 02:07 ParadaCarleton

I think an array size of 32 or 16 is more likely to be optimal, but this should probably be benchmarked.

The size just copies from base is fine

xiaodaigh avatar Jul 20 '21 03:07 xiaodaigh