Re:FreeBSD replaces bubblesort with mergesort on SYSINTs, re...
by naniwaduni on Monday August 21, 2023 @01:15AM
(#37205726)
You'd still think it'd be easier to write an insertion sort though, even accidentally! It's almost the same algorithm conceptually, except cutting out an odd pessimization.
grabbed the source and git blamed the file before the patch to see when the original code was from.
So the section was written in 98 and had some bits modified in 2001.The time wasted during boot here was probably irrelevant next to a hundred other things the project has worked on since.
the bubble sort was good enough that 25 years later they replaced it to save only 2ms during boot.
seems reasonable to me.