From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: master 4b79c80c999 1/2: New function 'sort-on' Date: Mon, 05 Feb 2024 17:10:09 +0200 Message-ID: <86il330wxa.fsf@gnu.org> References: <170688047526.14693.2994051491358257471@vcs2.savannah.gnu.org> <20240202132756.4272CC0EFE7@vcs2.savannah.gnu.org> <87cytej4hy.fsf@daniel-mendler.de> <86zfwi52m1.fsf@gnu.org> <87plxe28as.fsf@web.de> <86wmrm50i5.fsf@gnu.org> <3ff9d4cf-7b4f-4924-8663-3f43625760bf@gutov.dev> <86le7z0yqh.fsf@gnu.org> <005a364e-5058-42ae-b679-96dc046dccea@gutov.dev> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13586"; mail-complaints-to="usenet@ciao.gmane.io" Cc: yuri.v.khan@gmail.com, michael_heerdegen@web.de, jwiegley@gmail.com, emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Feb 05 16:11:15 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rX0ct-0003NJ-1N for ged-emacs-devel@m.gmane-mx.org; Mon, 05 Feb 2024 16:11:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rX0cE-0001No-U5; Mon, 05 Feb 2024 10:10:35 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rX0c8-0001NS-8N for emacs-devel@gnu.org; Mon, 05 Feb 2024 10:10:29 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rX0c7-0004MI-Da; Mon, 05 Feb 2024 10:10:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=8l+DYxPTVzgCfmY/rO4FZujoLDezt4IJSzN2M3VaDj0=; b=LQbfBfnKXrr5 39Fzl/iH9Evn0ZylNtEi/nTRfOVdkBYl/WeKKLlRS0ouOXtdJvdDeaifOmOqGiIj/woauvVZgZdI2 6UwS6hS1lgZPb6Hv1sbb5TVmMcprWQPq6ewzEkCrFSNG+kcdFAQgxCMz7pAf1ojaDbZCokVBKUceG w2sV/yelCC+0QwBP44WV7IdGlXYlkrNWDc8AxTk9QBTQb+KdvOeLgTqctemg2eUGkfluoNxa+TYkG vlrbanwGRLa9y4o8vhggW5ltbPOQW5NJbl5iJasGtRwDy56RiiLGltyz42MtSIMRvCKmgsc5F4iKh ZmdC/cXEDaMWKBxHSE11Uw==; In-Reply-To: <005a364e-5058-42ae-b679-96dc046dccea@gutov.dev> (message from Dmitry Gutov on Mon, 5 Feb 2024 16:47:39 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:315896 Archived-At: > Date: Mon, 5 Feb 2024 16:47:39 +0200 > Cc: yuri.v.khan@gmail.com, michael_heerdegen@web.de, jwiegley@gmail.com, > emacs-devel@gnu.org > From: Dmitry Gutov > > On 05/02/2024 16:31, Eli Zaretskii wrote: > >> Date: Mon, 5 Feb 2024 15:25:59 +0200 > >> Cc: Eli Zaretskii, Michael Heerdegen > >> , John Wiegley, > >> emacs-devel@gnu.org > >> From: Dmitry Gutov > >> > >> On 05/02/2024 07:30, Yuri Khan wrote: > >>> On Mon, 5 Feb 2024 at 07:49, Dmitry Gutov wrote: > >>> > >>>> The result would make it destructive and consequently faster (not > >>>> entirely non-consing, but close to it--while the current sort-on creates > >>>> two extra lists of length N), which should fit the original goal: a > >>>> faster sorting routine then uses ACCESSOR. > >>> Schwartzian transform transforms a sort algorithm that is O(n log n) > >>> accessor calls + O(n log n) comparison calls into one that is O(n) > >>> accessor calls + O(n log n) comparison calls. Depending on the > >>> accessor expensiveness, that may or may not balance out the consing > >>> and eventual GC. > >> Users who don't want to use the transform could inline the accessor > >> calls into the comparison function instead (as many have done in the > >> past). So if we document this properly, it should be fine. > > It's already documented (in the ELisp manual). > > You can't document something that's not in the tree. You can't say something is not in the tree when it is.