From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Subject: Re: Wrong info in libc comparison
Date: Wed, 13 Sep 2017 20:51:06 +0200 [thread overview]
Message-ID: <20170913185106.ddbgztckagdojcdd@voyager> (raw)
In-Reply-To: <20170913181010.GS1627@brightrain.aerifal.cx>
On Wed, Sep 13, 2017 at 02:10:10PM -0400, Rich Felker wrote:
> I'm not sure we agree on what introsort means -- normally I take it to
> mean doing an O(n²) algorithm with good "typical case" performance to
> begin with, but switching to an O(log n) algorithm with a worse
> constant factor as soon as it detects a risk that time will grow
> quadratically. Normally this is something like starting with quicksort
> and possibly switching to heapsort, and my understanding at the time
> was that glibc was doing that or something similar, and AFAIK it still
> is in the general case where there's insufficient memory for a merge
> sort. Does that sound incorrect?
>
> Rich
At least the version I was looking at (2.19) doesn't do that at all. As
I said, even in case of failed malloc(), all it does is a quicksort.
With an insertion sort afterwards, but that's not introsort by either of
our definitions. And in any case, malloc() failure is rare these days,
so the main algorithm is merge sort.
I just checked the version Debian is currently distributing (2.24) and
saw that nothing major has changed. stdlib/msort.c contains the merge
sort algorithm, and stdlib/qsort.c contains the quicksort fallback, for
your perusal.
Ciao,
Markus
next prev parent reply other threads:[~2017-09-13 18:51 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 [this message]
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
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=20170913185106.ddbgztckagdojcdd@voyager \
--to=nullplan@gmx.net \
--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).