From: "Zack Weinberg" <zack@owlfolio.org>
To: "Adhemerval Zanella" <adhemerval.zanella@linaro.org>,
"GNU libc development" <libc-alpha@sourceware.org>
Cc: "Florian Weimer" <fweimer@redhat.com>,
"Noah Goldstein" <goldstein.w.n@gmail.com>
Subject: Re: [PATCH] stdlib: Reinstate stable mergesort implementation on qsort
Date: Wed, 06 Dec 2023 16:11:20 -0500 [thread overview]
Message-ID: <6e3e2977-017b-49e5-b30b-b8fa1ddfde17@app.fastmail.com> (raw)
In-Reply-To: <20231206202228.1842209-1-adhemerval.zanella@linaro.org>
On Wed, Dec 6, 2023, at 3:22 PM, Adhemerval Zanella wrote:
...
> The drawback is mergesort requires O(n) extra space, and since it is
> allocated with malloc the function is AS-signal-unsafe. It should be
> feasible to change it to use mmap, although I am not sure how urgent
> it is. The heapsort is also nonstable, so programs that require a
> stable sort would still be subject to this latent issue.
It might be worthwhile investigating "block sort" aka "grail sort", which
is merge sort modified to be in-place and stable via clever reshuffling of
the input array. For experimental purposes we could drop in either of
these implementations (one is Unlicense and the other is MIT):
https://github.com/BonzaiThePenguin/WikiSort
https://github.com/HolyGrailSortProject/Rewritten-Grailsort
zw
next prev parent reply other threads:[~2023-12-06 21:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-06 20:22 Adhemerval Zanella
2023-12-06 21:11 ` Zack Weinberg [this message]
2023-12-08 16:17 ` Florian Weimer
2024-01-02 13:03 ` Adhemerval Zanella Netto
2023-12-08 16:42 ` Florian Weimer
2024-01-02 13:18 ` Adhemerval Zanella Netto
2023-12-08 17:36 ` Florian Weimer
2024-01-02 13:26 ` Adhemerval Zanella Netto
2024-01-12 13:57 Adhemerval Zanella
2024-01-12 18:23 ` Florian Weimer
2024-01-12 18:29 ` Adhemerval Zanella Netto
2024-01-12 19:02 ` Florian Weimer
2024-01-12 19:05 ` Adhemerval Zanella Netto
2024-01-13 12:35 ` Xi Ruoyao
2024-01-13 12:38 ` Florian Weimer
2024-01-13 12:47 ` Xi Ruoyao
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=6e3e2977-017b-49e5-b30b-b8fa1ddfde17@app.fastmail.com \
--to=zack@owlfolio.org \
--cc=adhemerval.zanella@linaro.org \
--cc=fweimer@redhat.com \
--cc=goldstein.w.n@gmail.com \
--cc=libc-alpha@sourceware.org \
/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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).