From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= 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 00:44:30 +0100 Message-ID: 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> <9447dde3-b8e7-2ec0-9a9c-72c4cf9d12a8@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8393"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Daniel Mendler , Eli Zaretskii , Stefan Monnier , 47711@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 27 01:42:56 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 1qwA07-00020D-GK for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Oct 2023 01:42:55 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qw9zo-00071Y-Sa; Thu, 26 Oct 2023 19:42:36 -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 1qw9zj-00071B-HS for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 19:42:32 -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 1qw9zj-0005fQ-7W for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 19:42:31 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qwA0D-000299-Vd for bug-gnu-emacs@gnu.org; Thu, 26 Oct 2023 19:43:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Oct 2023 23:43: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.16983637558217 (code B ref 47711); Thu, 26 Oct 2023 23:43:01 +0000 Original-Received: (at 47711) by debbugs.gnu.org; 26 Oct 2023 23:42:35 +0000 Original-Received: from localhost ([127.0.0.1]:34692 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qw9zl-00028P-RX for submit@debbugs.gnu.org; Thu, 26 Oct 2023 19:42:35 -0400 Original-Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]:49561) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qw9zV-00027r-Ti for 47711@debbugs.gnu.org; Thu, 26 Oct 2023 19:42:33 -0400 Original-Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-507973f3b65so2318933e87.3 for <47711@debbugs.gnu.org>; Thu, 26 Oct 2023 16:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698363701; x=1698968501; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wbZzpP8thL5Wk6dNJ8DGbP2ctAPz2XZTQIVB28HoBL4=; b=Kx3g/W6KvZixB9GFeekA1Q6oUCSKqO8OBgyCd4Pfjmy7+EdpuOReSL/Gh1nbfluvyB 93iwbVT9+srZe2rfoXpx6yC3HvXpAyANZsKl2w+dj+PdOtlhH2uASvoowUASbx9x5LWq AMKMue8Lb9lPxZgEt/WBYAh3HLii3kOeVr92LCbX1CuHqJW7lBjS76nqyTCqIoRz5m5T y/WxTRY4w/4i7rZlfQ2Uv6mDVnEg5xChUflkf7+OZBFox76cVy7BzzKr2wWppNVBlvNd UigwFtshN66TIkdiqEyxkbLKqvqWd4jlXXssipu19ixPzynoRSTw3Q/ogvwaUmymzq7v dkZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698363701; x=1698968501; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wbZzpP8thL5Wk6dNJ8DGbP2ctAPz2XZTQIVB28HoBL4=; b=YIld245BhGuJSeaG4//ucxpTd5yHo0JZzj8T+0A6px/sFItrYPncjhOyAlIwRjU/b9 gKiDlDzzijZm5EYxz7/qHwvMB6B+cR7cDnAA14/LpTJPKsrWetlkHtzeopgFdzXQf/BB wrRLREwy+/i2ro7F+HXa9BUoCaz4qJtRV7tcH+qD3oJhCY68N0ao55l0g21B/Lr2diOS Y3cXKRHR8FU4bQSqkJZjStTKxlYU/Swi8Widjej7yq1El0Kbl1IiS3ZcCCofphpGAnR4 DeOzkG+SgYF3RMxU9hMhhWGMNJuvaoKVHnkLUNplHQvaD5l7KRPQfCvXUcsj8etMRhSn 1zJw== X-Gm-Message-State: AOJu0YxOz/YtsbKIbHuz3BkrZjOCSj71TnDJ4MaUGvlu/aLDAowgi8dV U5B+y10PqIk63ECOoLGYmKa5eKNd1dmCkbYsu9E= X-Google-Smtp-Source: AGHT+IFQ/VCxnY+/umizpeU0Q1ONBXViGD+xbss6XohTerqPqlc0aQQt/XifONu6gyhD9qGsVHfedMRbYLrbketLWpw= X-Received: by 2002:a05:6512:4024:b0:4fe:49d:6ae2 with SMTP id br36-20020a056512402400b004fe049d6ae2mr856804lfb.0.1698363700513; Thu, 26 Oct 2023 16:41:40 -0700 (PDT) In-Reply-To: <9447dde3-b8e7-2ec0-9a9c-72c4cf9d12a8@gutov.dev> 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:273326 Archived-At: On Fri, Oct 27, 2023 at 12:25=E2=80=AFAM Dmitry Gutov wr= ote: > > On 25/10/2023 20:52, Jo=C3=A3o T=C3=A1vora wrote: > > And make sure to put 300 000 symbols in the obarray. The symbols are > > prefixed "yoyo" deliberately. > > > > (cl-loop repeat 300000 do (intern (symbol-name (gensym "yoyo")))) > > > > First a micro-benchmark: > > > > ;; Daniel's patch worked by Dmitry (v3) > > (benchmark-run 50 > > (let ((completion-styles '(flex))) > > (completion-filter-completions "" obarray 'fboundp 0 nil) > > (completion-filter-completions "yo" obarray 'fboundp 0 nil) > > (completion-filter-completions "yoo" obarray 'fboundp 0 nil) > > ));; =3D> (12.192422429999999 3 0.107881004) > > > > > > ;; lazy-hilit v4 patch attached in this email > > (benchmark-run 50 > > (let ((completion-styles '(flex)) > > (completion-lazy-hilit (cl-gensym))) > > (completion-all-completions "" obarray 'fboundp 0 nil) > > (completion-all-completions "yo" obarray 'fboundp 0 nil) > > (completion-all-completions "yoo" obarray 'fboundp 0 nil) > > ));; =3D> (12.267915333 4 0.14799709099999991) > > Note on this particular test: > > The loop on the first line only creates the symbols in the obarray, but > not functions. As a result, all the completion-all-completions calls > return nil because of the 'fboundp' predicate. When you change the > predicate argument to nil, these timings change considerably (so it's > wiser to reduce the number of repetitions to 1 or 5 at most), with > completion-filter-completions being ~2.5x faster than the other. Right, I missed this. I can reproduce it, though only around 2.0x faster h= ere. > It is slower in the sorting step, though: mostly due to the extra > consing created with the alist to-be-sorted, I guess, but also because > of the repeated string-match call (which, while fast and much faster > than the match-data call, is still not free). And is the sorting step not included in the full call to completion-filter-completions? I don't fully understand how it works. > That's how when compared in practice using fido-vertical-mode the > results were about the same. But that's what matters right? Also in the last iteration of the "yoyo" fido-vertical-mode test, results with my latest patch are quite a bit faster. Jo=C3=A3o