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#47711: bug#48841: bug#47711: bug#48841: bug#47711: [PATCH VERSION 2] Add new `completion-filter-completions` API and deferred highlighting Date: Fri, 27 Oct 2023 02:10:48 +0300 Message-ID: <2703531c-333f-c4a1-837b-c151ef3fd57d@gutov.dev> References: <3d3f894f-a6fa-53ae-5d50-c3aa9bffc73e@daniel-mendler.de> <56ab18b1-4348-9b2c-85bb-af9b76cd429a@daniel-mendler.de> <328f87eb-6474-1442-e1ca-9ae8deb2a84a@yandex.ru> <83fsvcbio7.fsf@gnu.org> <9f432d18-e70f-54c1-0173-1899fb66d176@gutov.dev> <877cnafv39.fsf@gmail.com> <8734xy73n7.fsf@gmail.com> <87zg05awbw.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="22272"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: Daniel Mendler , Eli Zaretskii , 47711@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 27 01:11:59 2023 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 1qw9W9-0005ZK-Vx for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Oct 2023 01:11:59 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qw9Vl-0002IJ-GF; Thu, 26 Oct 2023 19:11:33 -0400 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 1qw9Vj-0002I1-Bp for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 19:11:31 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qw9Vj-0003H4-3s for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 19:11:31 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qw9WD-0001Mr-Mj for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 19:12:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Oct 2023 23:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47711 X-GNU-PR-Package: emacs Original-Received: via spool by 47711-submit@debbugs.gnu.org id=B47711.16983618955221 (code B ref 47711); Thu, 26 Oct 2023 23:12:01 +0000 Original-Received: (at 47711) by debbugs.gnu.org; 26 Oct 2023 23:11:35 +0000 Original-Received: from localhost ([127.0.0.1]:34671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qw9Vn-0001M8-4t for submit@debbugs.gnu.org; Thu, 26 Oct 2023 19:11:35 -0400 Original-Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:45441) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qw9Vi-0001Lq-G9 for 47711@debbugs.gnu.org; Thu, 26 Oct 2023 19:11:34 -0400 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 2F50832001C6; Thu, 26 Oct 2023 19:10:53 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 26 Oct 2023 19:10:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1698361852; x=1698448252; bh=tzgnEix9LB8sXL5wpLsY1z6o4QCd+8ljipD NhAoNyaU=; b=Ea0Ckc2kQOf/jY6vUPXo61Age/d6p8JyDeFDyuejyyE4ueW8XQi XBOhZP+poXv+rUGmWwntQX0aZIPcfUNeO3n2Fcw4T6TgEeXPr3GAdper2ZglXLfB LboqrjfxpUDU2wyI/rLhS0/YCuwBvQZPIfSl/xym7HBglcrestImA2zxdHz6ipCR 6yRfldZngaa7V7pdE8zbThH8sEcHHWymb2Ik52/tmF9LQR4mVAeMBS+LVaP/gVmT KOO/ie59PCNoa0FsrQLqwYbhx8UHAkFEi16+tw0ytxj/jN0RwfZO2JJ+Ay9TOm/x mW25Dtq187JfPOd63IHUdnuUkBHw/fC3BzQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1698361852; x=1698448252; bh=tzgnEix9LB8sXL5wpLsY1z6o4QCd+8ljipD NhAoNyaU=; b=Bej7yE2QKN9gCwqn6uMHxWh7YepbkpnbKWZ16edS6Mx1ercHAUy aEddnYACKrWz9pW6zfxEZySIHL+ZenZHV2ZvRuzLoPEnPRIvfXQtUQ6bv8hJ93SZ dlpE23i5dy8aJhQGd9wwnmUlDlce180DqpwXCRtV4PWIUo1V42bgi1oNC//36d+K REQd9pFMLz5dB8Lrr4O0GdSVtTAuMCGUsOzky/vKMR5R4JQH5IrPdDdh34zcxcfI fj9gluk6x/0BnT3hEYBfpxD6HIMT8KKhDn3cgW1m9JxUvo39qi15ucPZU9r4jB9i TGQRQdzYcl+MhqUvaLbQCrmCh/81kMcZ6nQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrleefgddulecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthekredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpefhffehleejffegffeugefhkeektdffgfehjedvgeejtedtudehueffgffgfeej heenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Oct 2023 19:10:50 -0400 (EDT) Content-Language: en-US In-Reply-To: <87zg05awbw.fsf@gmail.com> 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:273322 Archived-At: Hi Joao, Thanks for the updates and the numbers. On 27/10/2023 00:49, João Távora wrote: > João Távora writes: > >> So, backed by the new ability to conduct good benchmarks, I looked at >> the problem anew. I found some insight in the problem, and came up with >> a new "lazy-hilit" patch which performs just as well, if not slightly >> better, than Daniel's, while keeping the changes to lisp/minibuffer.el >> much more minimal and not adding replacement for the longstanding >> completion-all-completions. > Working on this a bit more, I've now been able to optimize the "lazy > hilit" patch even further by recognizing that in many situations we > don't need to match the "PCM" pattern to each string twice. The first > time we do it, we can calculate a score immediately and store it in the > string. The average response times for the "yo-yoo" test described > previously: This latest change in particular regressed this related scenario: ;; Use 'set' to ensure that the variables are bound. (cl-loop repeat 300000 do (set (intern (symbol-name (gensym "yoyo"))) 4)) C-h v o ...> It increased the timings for that scenario from ~0.600s (with either of the latest filter-deferred patches and your previous version) to ~1s. My understanding is it's due to the judicious call (copy-sequence orig) that you added before 'put-text-property' is called. While it seems like a good idea to preserve the original value, when almost all of obarray matches the current input (which is the current scenario), a lot of strings will be copied. But (completing-read "" obarray) is not affected, and I don't see why. Maybe because it re-sorts less than icomplete? And the consing triggers the GC threshold less often (thanks to the other changes).