News for hackers. Stuff that matters.
Re:FreeBSD replaces bubblesort with mergesort on SYSINTs, re... by openasocket on Monday August 21, 2023 @02:10PM (#37213217)
If you look at the actual change in FreeBSD (https://cgit.freebsd.org/src/commit/?id=9a7add6d01f3c5f7eba8... ) you'll see that the implementation of bubble sort used in the FreeBSD kernel was not doing early exits.

  /*
  *
  * Perform a bubble sort of the system initialization objects by
  * their subsystem (primary key) and order (secondary key).
  */
 TSENTER2("bubblesort");
 for (sipp = sysinit; sipp < sysinit_end; sipp++) {
  for (xipp = sipp + 1; xipp < sysinit_end; xipp++) {
   if ((*sipp)->subsystem < (*xipp)->subsystem ||
        ((*sipp)->subsystem == (*xipp)->subsystem &&
         (*sipp)->order <= (*xipp)->order))
    continue; /* skip*/
   save = *sipp;
   *sipp = *xipp;
   *xipp = save;
  }
 }
 TSEXIT2("bubblesort");
Re:FreeBSD replaces bubblesort with mergesort on SYSINTs, re... by kragen on Monday August 21, 2023 @08:43PM (#37217168)
i very much appreciate you and erk posting this because we can also now see that it wasn't actually bubble sort but selection sort