Re:FreeBSD spends 7% of its boot time running a bubblesort o...
by jart on Friday May 19, 2023 @12:39PM
(#36003903)
* * *
Re:FreeBSD spends 7% of its boot time running a bubblesort o...
by rcxdude on Friday May 19, 2023 @01:10PM
(#36004356)
That's fair if the constant factor is relevant, but if bubble sort is terminating in any reasonable timescale then the difference between qsort, C++ std::sort, and a custom implementation is really not a factor.
Re:FreeBSD spends 7% of its boot time running a bubblesort o...
by jart on Friday May 19, 2023 @01:43PM
(#36004737)
People who don't compute much data don't need computer science.
Re:FreeBSD spends 7% of its boot time running a bubblesort o...
by paulddraper on Friday May 19, 2023 @03:31PM
(#36005911)
But if you're comparing to bubblesort.....
Re:FreeBSD spends 7% of its boot time running a bubblesort o...
by nice2meetu on Friday May 19, 2023 @01:39PM
(#36004689)
There is a quirk (almost a bug?) in FreeBSD's qsort where it will switch to insertsort for the whole array under certain conditions, which we hit in production given how our data was arranged.
(I think this was the check) https://github.com/freebsd/freebsd-src/blob/main/lib/libc/st...
Re:FreeBSD spends 7% of its boot time running a bubblesort o...
by stefan_ on Friday May 19, 2023 @10:57PM
(#36008978)
I like how someone felt the need to write out insertion sort in some 4 line code golf challenge in the midst of qsort. This right here is why no one wants to deal with C anymore.
Re:FreeBSD spends 7% of its boot time running a bubblesort o...
by erk__ on Saturday May 20, 2023 @02:03AM
(#36009710)
Did a bit of digging and found that there used to be a comment for why it was done, but it got removed [0] when they switched to the implementation from Bentley & McIlroy's "engineering a sort function" [1] around 1992.
[0]: https://github.com/weiss/original-bsd/commit/d3fcf71e0db57cb...
[1]: https://cs.fit.edu/~pkc/classes/writing/papers/bentley93engi...
Re:FreeBSD spends 7% of its boot time running a bubblesort o...
by JdeBP on Friday May 19, 2023 @02:22PM
(#36005185)
Nonetheless, qsort() is available in libkern.
Re:FreeBSD spends 7% of its boot time running a bubblesort o...
by canucker2016 on Friday May 19, 2023 @02:34PM
(#36005337)
Not at the time that the bubble-sort code was used though. see https://news.ycombinator.com/item?id=36005209
Re:FreeBSD spends 7% of its boot time running a bubblesort o...
by JdeBP on Friday May 19, 2023 @02:41PM
(#36005416)
You mean written. It's been available for many of the years that it has been used. (-:
Re:FreeBSD spends 7% of its boot time running a bubblesort o...
by IshKebab on Friday May 19, 2023 @03:52PM
(#36006102)
No. In most languages sorting a container is `foo.sort()` or something similar. `qsort()` is much more faff.
I mean, clearly it wasn't good enough otherwise they would have used it, no? Perhaps integrating it was a huge faff.
(More realistically, below people are discussing that in the kernel environment the set of standard or third party library available may be unavoidably limited)