Date: Sat, 16 Sep 2017 11:37:53 +0200 From: Szabolcs Nagy <nsz@...t70.net> To: musl@...ts.openwall.com Subject: Re: Wrong info in libc comparison * Markus Wichmann <nullplan@....net> [2017-09-15 21:18:46 +0200]: > On Wed, Sep 13, 2017 at 03:53:06PM -0400, Rich Felker wrote: > > If you're considering big-O, where n->infinity (or at least to the > > largest value that can fit in memory), malloc most certainly has > > failed (because the array to be sorted already filled memory) and > > you're looking at the "fallback" case. > > > > I think we're getting sidetracked here. Every libc worth its salt uses a > loglinear sorting algorithm. Thus they are all equal in that regard. that is not true at all. embedded libcs are often optimized for size, not worst case behaviour. note that worst-case behaviour is not just big-O.. (e.g. glibc uses mergesort which uses malloc which means it's not as-safe, may introduce arbitrary latency since malloc can be interposed, concurrent mallocs can delay forward progress, large allocation may cause swapping, cancellation or longjmp out of the cmp callback can leak memory etc.) > > Maybe the comparison of sort algorithm used is interesting for reasons > > other than just big-O though, in which case mentioning the "merge > > (when it fits in memory)" would probably be helpful. > > > > Rich > > Algorithms can be compared on a number of metrics, and just the name > doesn't tell us much (e.g. quicksort with naive "first element" pivot > selection has a pathological case on sorted input, while quicksort with > med3 pivot selection handles that very well). If you really want to know > something specific, you'll have to look it up in source, anyway. "mergesort+quicksort" sounds good to me, it tells enough about what's going on, if there is some known implementation mistake that can be added to the description (like "naive" quicksort for dietlibc implying O(n^2) worst case compares and potentially large stack use)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.