[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Change Emacs 'sort' API to use three-way comparison
From: |
Lars Ingebrigtsen |
Subject: |
Re: Change Emacs 'sort' API to use three-way comparison |
Date: |
Sat, 30 Aug 2014 16:23:06 +0200 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (gnu/linux) |
Paul Eggert <address@hidden> 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/
- Re: [Emacs-diffs] trunk r117765: Add vectors support to Fsort., (continued)
- Re: [Emacs-diffs] trunk r117765: Add vectors support to Fsort., Jordon Biondo, 2014/08/29
- Re: [Emacs-diffs] trunk r117765: Add vectors support to Fsort., Dmitry Antipov, 2014/08/29
- Re: [Emacs-diffs] trunk r117765: Add vectors support to Fsort., Jordon Biondo, 2014/08/29
- Re: [Emacs-diffs] trunk r117765: Add vectors support to Fsort., Dmitry Antipov, 2014/08/29
- Re: [Emacs-diffs] trunk r117765: Add vectors support to Fsort., Jordon Biondo, 2014/08/29
- Re: [Emacs-diffs] trunk r117765: Add vectors support to Fsort., Stefan Monnier, 2014/08/29
- Re: [Emacs-diffs] trunk r117765: Add vectors support to Fsort., Dmitry Antipov, 2014/08/29
- Re: [Emacs-diffs] trunk r117765: Add vectors support to Fsort., Richard Stallman, 2014/08/30
Change Emacs 'sort' API to use three-way comparison, Paul Eggert, 2014/08/29