What does HackerNews think of sort?

Sorting routine implementations in "template" C

Language: C

Along the same lines, I use Christopher Swenson's sort.h at https://github.com/swenson/sort/

  You get the choice of many sorting routines, including:

    Timsort (stable)
    Quicksort
    Merge sort (stable)
    In-place merge sort (not stable)
    Shellsort
    Binary insertion sort
    Heapsort
    Selection sort (this is really only here for comparison)
    Grail sort (stable)
    Sqrt Sort (stable, based on Grail sort, also by Andrey Astrelin).
But is he right? At what point is it unethical for an ethical person to continue to work for an unethical company? When should people who work for an unethical face personal negative effects?

He's not unique in this viewpoint. Quoting jwz: "As I've said before, if you work for Facebook, you should quit; it's the only morally defensible thing for you to do."

> his entire software stack depends ...

That sounds like the Mr. Gotcha meme: https://thenib.com/mister-gotcha/ . Again referring to jwz, his nightclub is on Facebook and Instagram because it's not economically viable to avoid them. ... Gotcha!

Similarly, it's hard to avoid all software which doesn't have influence from the big tech companies. I used https://github.com/swenson/sort ('Sorting routine implementations in "template" C"), and even this little indy package has contributors from Google Inc and the main developer worked at Google for a year.

DeVault's working on a new programming language, Hare. You could view that as having the long-term unstated goal of escaping unethical companies.

This article doesn't really make it clear but the merge sort discussion is specifically about glibc's implementation of qsort(). glibc's qsort() and Wine's qsort() are the only ones I know of that use merge sort to implement qsort(). Most implementations use quick sort.

I recently did my own benchmarking on various qsort()s since I was trying to implement a faster one. The various BSDs and macOS qsort() are all faster than glibc at sorting integers and they don't allocate memory:

https://github.com/ludocode/pottery/tree/master/examples/pot...

Of course sorting is much faster if you can inline the comparator so a templated sort algorithm is always going to be faster than a function that takes a function pointer. But this does not require C++; it can be done in plain C. The templated intro_sort from Pottery (linked above) is competitive with std::sort, as are the excellent swensort/sort templates:

https://github.com/swenson/sort

FWIW, for sorting in a template-like C package I use https://github.com/swenson/sort/ .
For now I found the Christopher Swenson's collection (https://github.com/swenson/sort) . This is more than nothing, but it is clearly not enough.