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.bugs Subject: bug#48841: fido-mode is slower than ido-mode with similar settings Date: Mon, 14 Jun 2021 03:08:13 +0300 Message-ID: <033e12e5-86e2-cb0c-ac8b-6753b96fa4b2@yandex.ru> References: <87eedgy7pt.fsf@gmail.com> <1f659c88-4d9d-8fc9-733a-5e6068f9ed4a@yandex.ru> <87a6o3x5j7.fsf@gmail.com> <87y2bnv5xc.fsf@gmail.com> <35be6652-9c8d-ee21-e9eb-9598ad6777eb@yandex.ru> <858682b2-b8fd-898b-bef3-97dbe5e4debc@yandex.ru> <878s3gugqj.fsf@gmail.com> <87zgvtu9bm.fsf@gmail.com> 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="40135"; 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: Stefan Monnier , 48841@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 14 02:09:21 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1lsaAL-000AD9-Ms for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Jun 2021 02:09:21 +0200 Original-Received: from localhost ([::1]:58306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lsaAJ-0005Zw-EM for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Jun 2021 20:09:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lsaA3-0005Zl-P4 for bug-gnu-emacs@gnu.org; Sun, 13 Jun 2021 20:09:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33014) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lsaA2-00035w-Jc for bug-gnu-emacs@gnu.org; Sun, 13 Jun 2021 20:09:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lsaA2-0007IV-Fr for bug-gnu-emacs@gnu.org; Sun, 13 Jun 2021 20:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Jun 2021 00:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48841 X-GNU-PR-Package: emacs Original-Received: via spool by 48841-submit@debbugs.gnu.org id=B48841.162362930328003 (code B ref 48841); Mon, 14 Jun 2021 00:09:02 +0000 Original-Received: (at 48841) by debbugs.gnu.org; 14 Jun 2021 00:08:23 +0000 Original-Received: from localhost ([127.0.0.1]:44560 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lsa9O-0007Hb-Mv for submit@debbugs.gnu.org; Sun, 13 Jun 2021 20:08:22 -0400 Original-Received: from mail-wm1-f46.google.com ([209.85.128.46]:36647) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lsa9N-0007HO-Ad for 48841@debbugs.gnu.org; Sun, 13 Jun 2021 20:08:21 -0400 Original-Received: by mail-wm1-f46.google.com with SMTP id h11-20020a05600c350bb02901b59c28e8b4so11319933wmq.1 for <48841@debbugs.gnu.org>; Sun, 13 Jun 2021 17:08:21 -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=i9VUk7Qg3o9sOcj66Z8h+fz53TKbup8aW0SSsBcvg7I=; b=OPYkHaQbEq4JQJc8zrxHjhq2GD3ggHeuanlV/DzjTqSFUXipATMb9f+tkuhJRoUun2 13/dbz33XA0xm6lI/TU5Wr8UhLkTVlw47sN4zpcMNsd1EQmynN4gLN57e5J3ImHSGnwO wFSNcsMk1H7pQI87+YsXm/mYrPosIYVW+uiH2fIbgkPEDi1h9/A4OMi63L2fRXfkE/aQ f92ysdqJrqe2KZ/OwKG731PslklorGQ4cXA2/vgQk3PXPt6nVe6eqnQrU/w4EezZ39yh yQ6ei+gycfQKOiw5ptGex3KYC42sp7Vrk33DPEluGts4hin92OhLwKt0OG4UyDUPPbpP Kv8w== 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=i9VUk7Qg3o9sOcj66Z8h+fz53TKbup8aW0SSsBcvg7I=; b=D/3q0s7Gz48kSl6bvpQI8VYpYq+CLcXx24RrUzgEgaCh+kkMCAj8aK067oO6EK+We+ OwtMHcQeEajvnzKWDlNgs0ZC0IEN8LyrXyHbTRnS/BpF2++r7+57vua/BOOa8pmOro1h 0U2gjyQH8dDNmyIyR68l6rE25W4g01KCibr4dUoysz3icLIHO/Pj73p5ikxKd2yum37W 1ovgdY6FtvSX/idOt8JY6dHgUpwFx60WZp1McbmMAdQNJE/uH91/f7FRHeRQucEWk8QY KM9eLD5rkMWrmjMotp8fVgCYFOovN8sTAnahFC/QQhmd5ULcSSpybQIr6LOUWMXcmrHM vsEQ== X-Gm-Message-State: AOAM532MOPDbhW1YWnoBPFd8WOiX+jKcNpZRzLLEZcwR2bj71qssu8Gm LLg5VmbuSvSu1IlV5fwiIEhSXeHj0CM= X-Google-Smtp-Source: ABdhPJw9oWkie5K5umnB+eV9Qcc7JL56nZwJV0Akwv27crz/JvVpA1vEIDihzkd+grLKbP5qpv99jw== X-Received: by 2002:a05:600c:a45:: with SMTP id c5mr12709081wmq.153.1623629295376; Sun, 13 Jun 2021 17:08:15 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id g23sm17016678wmk.3.2021.06.13.17.08.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 13 Jun 2021 17:08:14 -0700 (PDT) In-Reply-To: <87zgvtu9bm.fsf@gmail.com> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:208466 Archived-At: On 13.06.2021 17:29, João Távora wrote: > Yeah, to be honest, once I'm done actually using these functions I > immediately evict the differences between try-completion, > completion-try-completion, try-try-completion-completion, or any of > these yoda-speak variations from my mental cache. > > Here I meant is that there was something apparently useless and slow (to > fido-mode at least) going on in that else branch. And there it was! >> Elapsed time: 0.329006s (0.246073s in 10 GCs) >> >> vs >> >> Elapsed time: 0.169200s (0.113762s in 5 GCs) >> >> I suppose the 40-70ms difference is due to delay in typing. > > No idea. In my (slower?) system, I typed C-u C-x C-e C-m pretty fast. > Presumably the C-m goes in before pp-eval-last-sexp has a chance to read > more input so I wouldn't think it's a delay in typing. Some input latency must be there, of course it depends on how fast Emacs is handling the previous events, how fast the machine is, etc. Anyway, I was just describing an easier way to benchmark the same effect (without having to hit the key sequence very quickly). Hope you or someone else find it useful. > I could > investigate, but since your measurements confirm the same tendency > anyway, I think this simple patch is what's needed to close this issue. Haven't tested it myself, but it looks like it will almost certainly work. > diff --git a/lisp/icomplete.el b/lisp/icomplete.el > index 08b4ef2030..5d37f47e7d 100644 > --- a/lisp/icomplete.el > +++ b/lisp/icomplete.el > @@ -859,13 +859,14 @@ icomplete-completions > (base-size (prog1 (cdr last) > (if last (setcdr last nil)))) > (most-try > - (if (and base-size (> base-size 0)) > - (completion-try-completion > - name candidates predicate (length name) md) > - ;; If the `comps' are 0-based, the result should be > - ;; the same with `comps'. > - (completion-try-completion > - name comps nil (length name) md))) > + (and (not fido-mode) ; Fido avoids these expensive calculations. Perhaps predicate it on the value of icomplete-hide-common-prefix instead? fido-mode sets it to nil, and this way we retain a better level of abstraction, and better backward compatibility for vanilla icomplete-mode users. Next step might be switching this var's default value to nil.