From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id GPX7LRZxX2TG7AAASxT56A (envelope-from ) for ; Sat, 13 May 2023 13:14:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id aOEQLRZxX2QDJgAAG6o9tA (envelope-from ) for ; Sat, 13 May 2023 13:14:30 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2829AEA8C for ; Sat, 13 May 2023 13:14:30 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pxnC3-00065S-U1; Sat, 13 May 2023 07:13:44 -0400 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 1pxnC0-00063d-Tx for emacs-orgmode@gnu.org; Sat, 13 May 2023 07:13:40 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pxnBx-0002q9-9o for emacs-orgmode@gnu.org; Sat, 13 May 2023 07:13:40 -0400 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-24e01ba9e03so7567903a91.1 for ; Sat, 13 May 2023 04:13:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683976416; x=1686568416; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=RFxSSc4vMppfBf3ckhfmDnIvKpaEhK1rpjISg4jmA38=; b=GaO2r2qZ/m14s5z5il63pSKz4wv2FDj/Fc4S+jmBE1cgT/UvKtPrz1lhCWTmNdlqvr oowOgt8iZ/t2ojI8eot6uDXHhJWvMLvZljf6m0vWaUuikvk3RwGcNg1LyvebhI3xqY65 ySaTS2j6oDVdYjScWJbpDJvq7NEXOUeIgn5aG0oEvkDBRAhCt31WDWSarZbVKBpyYSX2 wCIb+4wc/bBB3hb0yjwzoF9Tn51US8aPKmYQctaw4A2RuGZUtD3Wdj8UwivMSfSw+FHi 50LUKNv7+C9exWbLFUT1qOSZD5fXcjD1vuEyoylnmi0MdKI0RDIJJ6tPD+p6LnfAvFtp /lWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683976416; x=1686568416; h=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=RFxSSc4vMppfBf3ckhfmDnIvKpaEhK1rpjISg4jmA38=; b=cmyV6gaL9icilZ62fucFEpystsPt0/r4Ni5nin57TTm0Zkf8stYklzD3tVydrt7AQH WInz4tc012zs2gVJX4mWzzoVODLeLHN7FjbZjoqrlpfxr2zb3LJgvGlMvzINMtCVmISh WkNcM3vetJZm8xx+ad1YE2hqo72NQZwcSiGPjrxViy6vLWCopoYgScJLXSTiTffBvt1b RRPeT0Un4VNhh8a4nKEhboE+EcrNEYXwdpKc70IZkeFz9jqYsV7pOnAvUkEoNaRIpcHM PHB/g6WdFtTBYg/B9Dkxb5LfOYHw1b3mk7JRfDnMtZwzSj1aFhuZy0XUlRD/abqE9eq1 EDgA== X-Gm-Message-State: AC+VfDypdvYkOiuG1HxZpV7PIJuZY60E9l75t73mHZ2YdhISJbWvtG/c 7/Wh+YSubIKAmPGIxV2zgfBCRt2V0pnt+G8C7g== X-Google-Smtp-Source: ACHHUZ745OYujpnUGzvOE1YXG1isRIe8O1+dium83kYcEJqaqQXlHC0x4BEPx7wbOs7BZMNWku5lLQ6YJa7RUdTcUsQ= X-Received: by 2002:a17:90a:d252:b0:250:1d63:3227 with SMTP id o18-20020a17090ad25200b002501d633227mr27783768pjw.10.1683976415573; Sat, 13 May 2023 04:13:35 -0700 (PDT) MIME-Version: 1.0 References: <878rds1xta.fsf@localhost> In-Reply-To: <878rds1xta.fsf@localhost> From: stardiviner Date: Sat, 13 May 2023 19:13:09 +0800 Message-ID: Subject: Re: Improve the performance of `org-set-tags-command` on large `org-tag-alist` To: Ihor Radchenko Cc: Org-mode Content-Type: multipart/alternative; boundary="0000000000000f7acb05fb9150c4" Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=numbchild@gmail.com; helo=mail-pj1-x1033.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_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683976470; a=rsa-sha256; cv=none; b=rM8iQHQg7EVwxzF6HMfP60+8nyQT3yJBUtjDCUSvGysm3/1RCGrpjM4iDpSSie6NncuAhg uhV4UiszFx+wuFyGfKBaQVd4vwQShaqj5OX26GxM1xE93998mMdTGG6spVYBfAxNVACM4i 5QGVZsgQGMVsSHGtXFApmgPI5JL4YbfhpH39KTxWDgCba4kbxwy7s6r3qLOygpZ8Xnbroo eQ9Akxekx7CaNlQwNWfceVE29/aVrNIC1rEDXWWR44APVvdjS+m3HhFN+bHDcb5tMq5kRe TxV9rW8oW9rP5y0rL3HNvJbR1z5H0CpzxzXY6MTeGbvYhlpcYrlkRW+DDZfEsw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=GaO2r2qZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1683976470; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=RFxSSc4vMppfBf3ckhfmDnIvKpaEhK1rpjISg4jmA38=; b=np1Fzhd843frhWwiXeMTc2wbMU2zsu+LyBYl3CA34JXHO2tsnvQN/Y831TNNxnlWXNWPEi IpoEHA+k7+0SvwRuUAnKVWMtDFMToQUolUw1NMJJx5+edSc9UVDYFuUkUMYwHdqgq0QzIa 4kcxkM8xjXgwUzrHkfp1TBqgKtt1bzCvbHJmPFsnTt8NmawsFitYEo10FUui+SzdkzQm/g bSxJZluRA973I+vlrdK54PifFiIBkOocFHyrRH3ptmNbvPgrBU9FLF7pbIyezXB0cciLVe Bb57zpMoQgWbK+hlXVfqg8OpQXGpkhP6hJMF/RMn6EEbYHnwafuw5HXS37ks9g== X-Migadu-Spam-Score: -9.79 X-Spam-Score: -9.79 X-Migadu-Queue-Id: 2829AEA8C X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=GaO2r2qZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-TUID: 3qAJOiwtkeBX --0000000000000f7acb05fb9150c4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I applied your diff with a testing. This indeed solved the performance issue. Will this be updated in Org-mode source code? Also I come up with one thing, filter out tags which have shortcut keybinding bound. Because user defined shortcut key defined tags are not always on head of list. [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ On Sat, May 13, 2023 at 3:39=E2=80=AFPM Ihor Radchenko wrote: > stardiviner writes: > > > I have a large `org-tag-alist` value that contains about ~7000 tags. > > When I press [C-c C-q] `org-set-tags-command`. Emacs suspends a long > time. > > Indeed. That's because `org-fast-tag-selection' tries to put all those > 7k tags into tag selection window. > > We can probably limit the maximum number of tags in the quick selection > window. > > Can you try the attached simple diff for `org-fast-tag-selection' and > check if it is enough to solve the hang? > > > -- > Ihor Radchenko // yantar92, > Org mode contributor, > Learn more about Org mode at . > Support Org development at , > or support my work at > --0000000000000f7acb05fb9150c4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I applied your diff with a testing. This indeed solved the= performance issue.
Will this be updated in Org-mode source code?
Also I come up with one thing, filter out tags which have = shortcut keybinding bound. Because user defined shortcut key defined tags a= re not always on head of list.

[stardiviner]=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 <Hack this world!>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 G= PG key ID: 47C32433
IRC(freeenode): stardiviner =C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 Twitter:=C2=A0 @numbchild
Key fingerprint =3D 9BAA 92BC = CDDD B9EF 3B36=C2=A0 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Sat, May 13, 2023 at 3:39=E2=80=AFPM= Ihor Radchenko <yantar92@posteo.= net> wrote:
stardiviner <numbchild@gmail.com> writes:

> I have a large `org-tag-alist` value that contains about ~7000 tags. > When I press [C-c C-q] `org-set-tags-command`. Emacs suspends a long t= ime.

Indeed. That's because `org-fast-tag-selection' tries to put all th= ose
7k tags into tag selection window.

We can probably limit the maximum number of tags in the quick selection
window.

Can you try the attached simple diff for `org-fast-tag-selection' and check if it is enough to solve the hang?


--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,=
or support my work at <https://liberapay.com/yantar92>
--0000000000000f7acb05fb9150c4--