From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: complexity in minibuffer Date: Wed, 2 Jun 2021 21:11:48 +0300 Message-ID: <5c1b585b-688e-2e5a-ea01-e32ecb70f034@yandex.ru> References: <871r9laj6a.fsf@gmail.com> <1b73a130-204c-76fb-2b60-02b814aee0f0@daniel-mendler.de> <87r1hl8xom.fsf@gmail.com> <878s3t8tzw.fsf@gmail.com> <3c68bd00-70ca-fa18-f9b8-cd03029f9294@daniel-mendler.de> <8735u18lsd.fsf@gmail.com> <8e33bbfe-0015-b85c-b57c-ba448f2e6215@yandex.ru> <3d519805-f602-fa52-ec69-0506bb6cb568@yandex.ru> <45be3e2f-82f6-087c-bfd8-5926a395d198@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1546"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 Cc: Daniel Mendler , Juri Linkov , Stefan Monnier , "emacs-devel@gnu.org" To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jun 02 20:12:37 2021 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 1loVM4-0000Gx-R7 for ged-emacs-devel@m.gmane-mx.org; Wed, 02 Jun 2021 20:12:36 +0200 Original-Received: from localhost ([::1]:43582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1loVM3-0004Ts-E0 for ged-emacs-devel@m.gmane-mx.org; Wed, 02 Jun 2021 14:12:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1loVLP-0003eW-Gd for emacs-devel@gnu.org; Wed, 02 Jun 2021 14:11:55 -0400 Original-Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:35513) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1loVLN-0005HH-AX for emacs-devel@gnu.org; Wed, 02 Jun 2021 14:11:55 -0400 Original-Received: by mail-wr1-x42d.google.com with SMTP id m18so3231999wrv.2 for ; Wed, 02 Jun 2021 11:11:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=PGRBltn5Kdlfa0iItc7OIpCMee+qTrScVy1UzWfkHEk=; b=GlRk0kR8/S690qM3Fn+qFjDaeFU5HKPhSIocgjIZHoiCzbUwUnCr+BbzUcHCEPaK/s Nxm/00b2757IHIYVdWcvnj2JIqQ/9p82h9NdvHTI1NXGZq7i33fe5bJ1GLfghHodsVny YuTtr43kJfYSC0jeF83HSjRO+7gHZkItlX3XB9EriAJKT2Xkioax7bC0ODZNbOT1Bo3S FHNX72c+OVYGZs4pAcKBob2niTOr/w4QkHUx9VvrqjD5WsSFz+o59wjxsAd8yj0CExRo 9eEuoIdKVvZo+MOxZooylxf9q2Hrdt/yMSoZOWB+iUePOaX6dYtoctvAwgkDQ0yXNRWy 8s5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PGRBltn5Kdlfa0iItc7OIpCMee+qTrScVy1UzWfkHEk=; b=H0yBbD3PDFodVgEQ0wVKpDwahlowQ2eSvrLNaFLgdCLkeH1oPHQDGzQOtsjI5L5FSI bbysKwO/H+/qfyNFx54aI2qA0JFr6XXr4yUtjADuDra5Yk2m2w5XdbQQYd2m8/fkZQVU v9GDXyALSdQJXeGnEyUW8V0ySK6KRFzcSMnIKeozKPCOrwnuoGSAQ8NbxbYAKt81NdBx IbLm17veGuv/ozDn1zTGVxmUsptLFdNkR3tcFvsAvK5CDn0nh7RGzTqwM/g5abxNh7xS 5YJ9e+pxI4KN3Lnxb39uVNIGjI25klVgoDanbEEdNAQW6GLjA8Dd3PhyyWU4q0fFnQsk rDYg== X-Gm-Message-State: AOAM532BCVSiE1Ga8IOQNTwGpmof1/JswR+BptcHeJBbg+9+Qadn6m5Y WN0Uj+sFoR9niws1+sUr47g= X-Google-Smtp-Source: ABdhPJxuJtzIFDiTH424Dak3/Hn2oaRJw4ZIOhTx9Mth/HUEbDPU4ZMhVcrGHrFgoWi6dtaDNq/T5g== X-Received: by 2002:a5d:698e:: with SMTP id g14mr6875659wru.212.1622657511386; Wed, 02 Jun 2021 11:11:51 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id q5sm739195wrm.15.2021.06.02.11.11.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Jun 2021 11:11:50 -0700 (PDT) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=raaahh@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-0.613, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:270315 Archived-At: On 02.06.2021 18:37, João Távora wrote: >> Some transformations will be more costly than others (even if the >> current examples are pretty fast), so we shouldn't call them unless we >> know a given completion will be displayed. > > You're again misunderstanding my suggestion, and bringing > up the same concern, which I've already answered. Let me > try again. Call the total group of completions A. Invoke the group func > for every c in A, yes. _Don'_t transform every completion until you know > which ones to display, call this group D. Instead allocate a transform > function and attach it to each c in A. Then call this transform for each > c in D. I think I get it now, thanks: key-and-transform, which you proposed group-function would return, would have a transformer _function_ in its CDR. So overall it should be approximately as powerful as the current approach. An allocation of 10000 lambdas in the interpreter takes about 4 ms here, which is not too much. I could still describe some downsides (opaque properties on strings: harder to examine them; longer backtraces - that is something you have criticized in another proposal of mine, in a different discussion). Overall it's a valid idea, not without its elegance, but I don't think it's a definite enough improvement to ask everybody to rewrite their code, which uses the current definition of group-function. > My suggestion can also scrap the double invocation X (getting > the group may be expensive, for some backends). If that ever turns out to be a problem, we can of course use text properties and/or a hash table somewhere. But this is an argument about the implementation strategy for minibuffer.el, whereas the group-function convention affects more than that.