From: Lars Ingebrigtsen <larsi@gnus.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: Dmitry Antipov <dmantipov@yandex.ru>, emacs-devel@gnu.org
Subject: Re: Change Emacs 'sort' API to use three-way comparison
Date: Sat, 30 Aug 2014 16:23:06 +0200 [thread overview]
Message-ID: <87r3zyjbud.fsf@building.gnus.org> (raw)
In-Reply-To: <5400EE70.8050207@cs.ucla.edu> (Paul Eggert's message of "Fri, 29 Aug 2014 14:19:44 -0700")
Paul Eggert <eggert@cs.ucla.edu> writes:
> One infelicity I noticed in the recent change to 'sort' in the trunk
> is that the new implementation calls its predicate twice for each
> comparison. This is because the Lisp API says the comparison function
> returns a boolean (nil or non-nil), whereas qsort_r wants the
> comparison function to return a ternary value (-1, 0, or 1). If the
> predicate is expensive, the new Fsort can be twice as slow as the old.
> We could tune it but I don't see how to get it any faster than 1.5x
> slower than before, assuming random input and an expensive comparison
> function.
Uhm. Why has somebody introduced a new sort that's slower than the old
sort?
As somebody who sorts a lot of things in Emacs, that sounds kinda
... bad.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
next prev parent reply other threads:[~2014-08-30 14:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-29 10:46 [Emacs-diffs] trunk r117765: Add vectors support to Fsort Eli Zaretskii
2014-08-29 14:21 ` Jordon Biondo
2014-08-29 15:41 ` Dmitry Antipov
2014-08-29 15:50 ` Jordon Biondo
2014-08-29 16:34 ` Dmitry Antipov
2014-08-29 16:43 ` Jordon Biondo
2014-08-29 18:31 ` Stefan Monnier
2014-08-29 22:53 ` Dmitry Antipov
2014-08-31 0:18 ` Richard Stallman
2014-08-29 21:19 ` Change Emacs 'sort' API to use three-way comparison Paul Eggert
2014-08-29 21:51 ` David Kastrup
2014-08-30 14:23 ` Lars Ingebrigtsen [this message]
2014-08-30 16:45 ` Paul Eggert
2014-08-30 18:07 ` Lars Ingebrigtsen
2014-08-30 18:14 ` Paul Eggert
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r3zyjbud.fsf@building.gnus.org \
--to=larsi@gnus.org \
--cc=dmantipov@yandex.ru \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).