mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: Wrong info in libc comparison
Date: Sat, 16 Sep 2017 12:18:02 -0400	[thread overview]
Message-ID: <20170916161802.GY1627@brightrain.aerifal.cx> (raw)
In-Reply-To: <20170916093753.GB15263@port70.net>

On Sat, Sep 16, 2017 at 11:37:53AM +0200, Szabolcs Nagy wrote:
> > 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)

Even non-naive quicksort has O(n²) time; there is a way to avoid this
with an esoteric efficient algorithm for finding the median to use as
the pivot, but nobody does it because the constant is so bad. The only
known practical way to avoid the n² worst-case is some kind of
introsort. So "naive" is really only about the problem of blowing up
the stack.

I agree something like "mergesort+quicksort" sounds good, but just to
make sure, was mergesort already in use in the glibc version in the
comparison? i.e. can I make this fix without inconsistently reflecting
information from different glibc versions?

Rich


  parent reply	other threads:[~2017-09-16 16:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13 13:51 Markus Wichmann
2017-09-13 18:10 ` Rich Felker
2017-09-13 18:51   ` Markus Wichmann
2017-09-13 19:25     ` Szabolcs Nagy
2017-09-13 19:53       ` Rich Felker
2017-09-15 19:18         ` Markus Wichmann
2017-09-16  9:37           ` Szabolcs Nagy
2017-09-16 14:01             ` Markus Wichmann
2017-09-16 17:11               ` Szabolcs Nagy
2017-09-16 19:34                 ` Markus Wichmann
2017-09-16 16:18             ` Rich Felker [this message]
2017-09-16 18:38               ` Markus Wichmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170916161802.GY1627@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).