On Wed, Oct 24, 2018 at 5:18 PM Huw Davies huw@codeweavers.com wrote:
On 24 Oct 2018, at 13:49, Gabriel Ivăncescu gabrielopcode@gmail.com wrote:
On Wed, Oct 24, 2018 at 10:50 AM Huw Davies huw@codeweavers.com wrote:
I don't see why do you need a stable sort here. Using libc's qsort should be fine at first.
Because the strings are compared case insensitively, so keeping the order in which they are originally enumerated is important to distinguish this, since some apps want to have them in a certain way (and probably even provide them already sorted, for example, like files on a case-insensitive filesystem, i.e. Total Commander, which should be in the exact same way).
I still don't see why this matters.
Huw.
Because it will change the order of some strings "randomly" and depending on the platform it's ran under? How is that good behavior? Even adding items to a database will result in the rest being placed differently (compared to before) if they only differ in case, I don't see how that doesn't matter.
AutoComplete is also used for URLs and ftp in apps, and those are case-sensitive (but the search isn't). I think obtaining consistent behavior on all platforms is definitely preferable.
Nevermind the fact that it would be unusable for certain workloads if it doesn't use merge sort, due to very poor performance of other algorithms when it comes to expensive comparisons. Since qsort is not obliged to be implemented in merge sort (and in fact, I think only glibc uses merge sort, BSD doesn't), it's inadequate to rely on this to side-effect wine in this way.