X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Yikai Zhao <yikai@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 22 May 2025 06:17:05 +0000
Resent-Message-ID: <handler.78545.B.174789460916950 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: 78545 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.174789460916950
(code B ref -1); Thu, 22 May 2025 06:17:05 +0000
Received: (at submit) by debbugs.gnu.org; 22 May 2025 06:16:49 +0000
Received: from localhost ([127.0.0.1]:58789 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uHzET-0004Oh-Jj
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 02:16:48 -0400
Received: from lists.gnu.org ([2001:470:142::17]:34190)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <i@HIDDEN>) id 1uHzEL-0004Ju-N6
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 02:16:40 -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 <i@HIDDEN>) id 1uHzDt-0007xj-Ra
for bug-gnu-emacs@HIDDEN; Thu, 22 May 2025 02:16:16 -0400
Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from <i@HIDDEN>) id 1uHzDo-0007Dm-KM
for bug-gnu-emacs@HIDDEN; Thu, 22 May 2025 02:16:08 -0400
Received: by mail-wr1-x42a.google.com with SMTP id
ffacd0b85a97d-3a375e72473so2392598f8f.0
for <bug-gnu-emacs@HIDDEN>; Wed, 21 May 2025 23:16:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=z1k.dev; s=google; t=1747894560; x=1748499360; darn=gnu.org;
h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
:date:message-id:reply-to;
bh=IEQuxaCiFOdDfvuONh0IWGxIIhT8bre1CgWYiMoO7KY=;
b=bUVOYAqC2LgY6eltPaPyfLMybRy7Zl0q5865/w8IzRNhaUofQZUXKCO++Dk6/wylT6
eVSDOkgNQ9J8nXjR+GZ+Mo7q4js+zUFBVCzltmdfPckXC+ef48VOT4qYlaYwkOTlO6mA
t42qXaZ5CXEyzESeH8SuFSX9tbcez4HMbMc5J8FolvJ/dMDgi62OqbeLCdNTlOs1ZBMv
mOYHUytT6jsGd1J/L1GL9xoW6UMehS7fw2r8Q0qD76m3IHgqT1FuZj1q0vbxga8DT0y0
oOxYb3JtqhPHL458nlxRXs3kBokonj83rqccOYvUBV26jdPYfG5iVGs1oH2ZKVOJGaPd
Lvaw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1747894560; x=1748499360;
h=to:subject:message-id:date:from:mime-version:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=IEQuxaCiFOdDfvuONh0IWGxIIhT8bre1CgWYiMoO7KY=;
b=oHjfHBJnxyOf63CVFPvY5gnmJsBq36HDWmW/yGtq2mQqWTyGVLOOWlJMeoRWJa8bfy
UkuiGN9TckmEIorKWKP2X5j+jcZox9nyx7CJRXvgb3+H85R9SyDSvRVwTfwTTg7tmRU+
Cr9tyZBoeB/JB8/qIQg9xXOXMIRvkxHbVuJxjKODt/himWoUhm0WY9maKOuxfOLiB3QY
FKd5vbjMIDWCcOHnTFIUnu5vIvgLIxoNjCOgDEx6nVvR3mBjAGTsi6A1uHANdp84qf2H
BuwsdT863CQFhBwrvzkGRB3hs/SBW6JjVPjuIFVAAmOmrNs38feaoxtY2agUF9kQmXo5
k5vw==
X-Gm-Message-State: AOJu0YyvEEvTTGfhLDnagV3GhnpR36XHV6cYhO7FmtPL0A/v3uDkOfRR
lDWDueecYW6HU19Srsmo6UQmlS5KUYxsqR+HjWmehkwmQwCo7gldYhohvU2IRyvLlEEbECTDosy
FkNQxPd3el+/jhb/zwNFrfKu9xKmY7vjILb57GL/tNSHQLHUrkr8ViKI=
X-Gm-Gg: ASbGncu+HU18GC4smFrwa7llND/QI2fPOMPb98ay8Fl3/TNEUtnl+XzxVEvHlV9KeIm
fRzfKCAScZi+7GYQ/O+Z07Nz5fRSsBd5bo3YL2eCzwWtBpU+tPFcE7FA/TA0dxFkMLormpX5Hdm
/SiBCNaMa81JpBxXS+psv9xdSog3AIhto/fQQ0iAG+AFFYRpyZQM3ITB6iLB/yq+MGgzc=
X-Google-Smtp-Source: AGHT+IFZCcIbAXOfE2l+vgHJveqllTkGWsCfWnp8nfK360mGFiJnJoxoH13KZwwnqNWMXPrkzy6t69RaCnwiWTzyyy8=
X-Received: by 2002:a05:6000:178c:b0:3a3:671e:3b7c with SMTP id
ffacd0b85a97d-3a3671e3c09mr17680841f8f.48.1747894560341; Wed, 21 May 2025
23:16:00 -0700 (PDT)
MIME-Version: 1.0
From: Yikai Zhao <yikai@HIDDEN>
Date: Thu, 22 May 2025 14:15:49 +0800
X-Gm-Features: AX0GCFtIgHrdANH6PTknNMy9sWnJV8l93NQRQ0x11eMwfkLZnMJYLJyVTZGbuCY
Message-ID: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Received-SPF: pass client-ip=2a00:1450:4864:20::42a;
envelope-from=i@HIDDEN; helo=mail-wr1-x42a.google.com
X-Spam_score_int: -19
X-Spam_score: -2.0
X-Spam_bar: --
X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001,
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-Spam-Score: 1.0 (+)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)
After enabling `project-mode-line`, I find my emacs slightly less
responsive. I think it's because project-mode-line is slow due to
it trying to read files on each update. Here's how I reproduce it:
- Run `emacs -Q`
- Evaluate `(setopt project-mode-line t)`
- Open some random file in a non-project directory, e.g. `/tmp/test`,
start typing
Here's part of the profiling result:
114 62% - redisplay_internal (C function)
42 23% - eval
41 22% - project-mode-line-format
41 22% - project-current
41 22% - project--find-in-directory
41 22% - run-hook-with-args-until-success
41 22% - project-try-vc
41 22% - project-try-vc--search
25 13% - project--value-in-dir
22 12% - hack-dir-local-variables
22 12% - #<byte-code-function 24E>
22 12% - hack-dir-local--get-variables
22 12% - dir-locals-find-file
22 12% - locate-dominating-file
12 6% + abbreviate-file-name
3 1% + #<byte-code-function 98F>
13 7% - locate-dominating-file
6 3% + #<byte-code-function 4D9>
3 1% abbreviate-file-name
3 1%
It shows that `project-mode-line-format` can take a significant portion
of the redisplay time. It increases even more when the directory is deep
or the disk is slow.
IMO the performance of this function should be improved.
I have two questions:
1. Is it possible to simply cache the result as buffer-local?
2. IIUC some of the file reading comes from `project--value-in-dir`,
which opens a temporary buffer to load dir local variables. Why doesn't
it simply read the variable value in the current buffer?
Thanks
Yikai
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Yikai Zhao <yikai@HIDDEN> Subject: bug#78545: Acknowledgement (31.0.50; project-mode-line is slow because it tries to read files on each update) Message-ID: <handler.78545.B.174789460916950.ack <at> debbugs.gnu.org> References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN> X-Gnu-PR-Message: ack 78545 X-Gnu-PR-Package: emacs Reply-To: 78545 <at> debbugs.gnu.org Date: Thu, 22 May 2025 06:17:06 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 78545 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 78545: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D78545 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Ship Mints <shipmints@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 22 May 2025 11:48:02 +0000
Resent-Message-ID: <handler.78545.B78545.174791446328489 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Yikai Zhao <yikai@HIDDEN>
Cc: 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.174791446328489
(code B ref 78545); Thu, 22 May 2025 11:48:02 +0000
Received: (at 78545) by debbugs.gnu.org; 22 May 2025 11:47:43 +0000
Received: from localhost ([127.0.0.1]:32944 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uI4Ok-0007PO-9p
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 07:47:42 -0400
Received: from mail-vk1-xa32.google.com ([2607:f8b0:4864:20::a32]:60620)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
id 1uI4Oe-0007P2-0V
for 78545 <at> debbugs.gnu.org; Thu, 22 May 2025 07:47:37 -0400
Received: by mail-vk1-xa32.google.com with SMTP id
71dfb90a1353d-5259331b31eso2713839e0c.0
for <78545 <at> debbugs.gnu.org>; Thu, 22 May 2025 04:47:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1747914450; x=1748519250; darn=debbugs.gnu.org;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=HW2wIaWpZf9icMxc3Mum9J/w49xc1ykSlJ8e57nCKvA=;
b=a9Lg2NAcZlIMZCpl1jEH4dN06mvFYva+ZGZQFz8NRsX4I56Ymhwc7hCx17i2IX4ITQ
LwskUHhGRviU96qeZ0hxM+y6sY6ePAV/3gzW0InpubYFDKV49QhEa265y0MMdz6JR18x
Lyrk4j9i5OSO4d3DtoYinwp+AE8C76BPQvI9+N16hATTtccruRDracak6F6ctzRtD6Rt
9jZJzE9jW6QW6FvlICLhau/p3r5eFoGyeDDnHyduEm+UzZTyO1obYRU86NiFSwOWUCEH
htaInIIbAEvSaAuGFAsgr4Q+Ry5f4Y+VnFY7xrON6dfseg2YbEWqQ/1DXSy1IQOB8HdU
lvIQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1747914450; x=1748519250;
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=HW2wIaWpZf9icMxc3Mum9J/w49xc1ykSlJ8e57nCKvA=;
b=vF4moCxKPgQr5uOOweiiF3IW9ny9pF82Bhml126/HuhewMi3bh1R1GQZE2GkvwUD11
utR7FLYE68rBRpQiXC5yEFSLc4HQXGDXe7CWG/WDF7afSCgWlWAungtNWNF+xzWYfr02
35Fr7opizTIzrO6k1q94FsoYdYBo1hLvEwc/SszFNSnSPQPQJgJreGbWQV9L7etPP+oq
06jP/9jwKMsw12T8blzt3hzvppKjgoGNl1G+GvO2YnZFV961+Cb1nO3vsbqc5Q1fsrzA
IfQ/o0i6mJGYIv5mKd8S3QMEWioC1iG8s0D/o/DMDelyy7yQziGfuWe5D1LYf6g1AP3x
g/fQ==
X-Gm-Message-State: AOJu0Yzk7mrmHKb4IMrfvuuSs7eOYI7z2HkV8rP1rltBNXN/8L4qPxLX
iTnXxzRypxhRBF2R0VtrUiR3V1Uc/wkKchlc/8jlcw4XOILCvVveqQ9C/hrlsbT4ImPyQDgnGl3
tmTvpvlABFpnNq5Iv5rMck6IakrRC/qfEog==
X-Gm-Gg: ASbGncu1HRK06tg5Ls6eki/Pbb45SJjRAuTc9PHOpjBnqkILWTw+QwCTnDP7Xz9gUGk
Iw65+M+YefTQKLvo4bW+KsIy2aypj9RqHVv2dhBfSk8ENkyUp/KSFsx48739Y+6SO9vckimnO/N
m071PWCa3YYMYT+1pTvPpksInd58ngUHenNU8=
X-Google-Smtp-Source: AGHT+IGrIZBd6BNqLAEXgBE6MA6Fh/z+qbVMyCpNpKboxU9ur3XfGLUqKJGIWNB4Nx16m4+obL4WNACwPmN2L4xJwm0=
X-Received: by 2002:a05:6122:da2:b0:525:bf40:e628 with SMTP id
71dfb90a1353d-52dba90fdc7mr22407170e0c.6.1747914449853; Thu, 22 May 2025
04:47:29 -0700 (PDT)
MIME-Version: 1.0
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
In-Reply-To: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
From: Ship Mints <shipmints@HIDDEN>
Date: Thu, 22 May 2025 07:47:18 -0400
X-Gm-Features: AX0GCFvcNtP1jsCqSvJTifdXGagmftKEI_CM5qwuWQjwH63EFlWnLNnroY9e-fo
Message-ID: <CAN+1Hbr2z+5cfFz=B0rDyqbvpiVbFODuuDccUyCWP=mSYcWEsw@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000e1ac4c0635b80bf1"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
--000000000000e1ac4c0635b80bf1
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Thu, May 22, 2025 at 2:17=E2=80=AFAM Yikai Zhao <yikai@HIDDEN> wrote:
> After enabling `project-mode-line`, I find my emacs slightly less
> responsive. I think it's because project-mode-line is slow due to
> it trying to read files on each update. Here's how I reproduce it:
>
> - Run `emacs -Q`
> - Evaluate `(setopt project-mode-line t)`
> - Open some random file in a non-project directory, e.g. `/tmp/test`,
> start typing
>
> Here's part of the profiling result:
>
> 114 62% - redisplay_internal (C function)
> 42 23% - eval
> 41 22% - project-mode-line-format
> 41 22% - project-current
> 41 22% - project--find-in-directory
> 41 22% - run-hook-with-args-until-success
> 41 22% - project-try-vc
> 41 22% - project-try-vc--search
> 25 13% - project--value-in-dir
> 22 12% - hack-dir-local-variables
> 22 12% - #<byte-code-function 24E>
> 22 12% - hack-dir-local--get-variables
> 22 12% - dir-locals-find-file
> 22 12% - locate-dominating-file
> 12 6% + abbreviate-file-name
> 3 1% + #<byte-code-function 98F>
> 13 7% - locate-dominating-file
> 6 3% + #<byte-code-function 4D9>
> 3 1% abbreviate-file-name
> 3 1%
>
> It shows that `project-mode-line-format` can take a significant portion
> of the redisplay time. It increases even more when the directory is deep
> or the disk is slow.
>
> IMO the performance of this function should be improved.
>
> I have two questions:
>
> 1. Is it possible to simply cache the result as buffer-local?
> 2. IIUC some of the file reading comes from `project--value-in-dir`,
> which opens a temporary buffer to load dir local variables. Why doesn't
> it simply read the variable value in the current buffer?
>
I've advised project functions to cache the "invariants" current project
and project root to incur these costs once per buffer. I also cache the
nuance of a "non project" to avoid repeated project probing on buffers that
don't have a project.
I thought maybe I was the only person silly enough to invoke costly project
functions for every tab in `tab-bar` and every mode-line update.
I could contribute optional caching to project.el if there is sufficient
demand for it. Unless someone else wants to.
--000000000000e1ac4c0635b80bf1
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Thu, May 22, 2025 at 2:17=E2=80=AFAM Yikai Zhao <<a href=3D"mailto:yi=
kai@HIDDEN">yikai@HIDDEN</a>> wrote:</span></div></div><div class=3D"g=
mail_quote gmail_quote_container"><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex">After enabling `project-mode-line`, I find my emacs slightly les=
s<br>
responsive. I think it's because project-mode-line is slow due to<br>
it trying to read files on each update. Here's how I reproduce it:<br>
<br>
- Run `emacs -Q`<br>
- Evaluate `(setopt project-mode-line t)`<br>
- Open some random file in a non-project directory, e.g. `/tmp/test`,<br>
start typing<br>
<br>
Here's part of the profiling result:<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0114=C2=A0 62% - redisplay_internal (C fun=
ction)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 42=C2=A0 23%=C2=A0 - eval<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 41=C2=A0 22%=C2=A0 =C2=A0- project-mode-=
line-format<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 41=C2=A0 22%=C2=A0 =C2=A0 - project-curr=
ent<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 41=C2=A0 22%=C2=A0 =C2=A0 =C2=A0- projec=
t--find-in-directory<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 41=C2=A0 22%=C2=A0 =C2=A0 =C2=A0 - run-h=
ook-with-args-until-success<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 41=C2=A0 22%=C2=A0 =C2=A0 =C2=A0 =C2=A0-=
project-try-vc<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 41=C2=A0 22%=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
- project-try-vc--search<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 25=C2=A0 13%=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0- project--value-in-dir<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 22=C2=A0 12%=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 - hack-dir-local-variables<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 22=C2=A0 12%=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0- #<byte-code-function 24E><br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 22=C2=A0 12%=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 - hack-dir-local--get-variables<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 22=C2=A0 12%=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0- dir-locals-find-file<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 22=C2=A0 12%=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 - locate-dominating-file<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 12=C2=A0 =C2=A06%=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ abbreviate-file-name<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A03=C2=A0 =C2=A01%=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 + #<byte-code-function 98F><br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 13=C2=A0 =C2=A07%=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0- locate-dominating-file<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A06=C2=A0 =C2=A03%=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 + #<byte-code-function 4D9><br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A03=C2=A0 =C2=A01%=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 abbreviate-file-name<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A03=C2=A0 =C2=A01%<br>
<br>
It shows that `project-mode-line-format` can take a significant portion<br>
of the redisplay time. It increases even more when the directory is deep<br=
>
or the disk is slow.<br>
<br>
IMO the performance of this function should be improved.<br>
<br>
I have two questions:<br>
<br>
1. Is it possible to simply cache the result as buffer-local?<br>
2. IIUC some of the file reading comes from `project--value-in-dir`,<br>
which opens a temporary buffer to load dir local variables. Why doesn't=
<br>
it simply read the variable value in the current buffer?<br></blockquote><d=
iv><br></div><div class=3D"gmail_default" style=3D"font-family:monospace">I=
've advised project functions to cache the "invariants" curre=
nt project and project root to incur these costs once per buffer.=C2=A0 I a=
lso cache the nuance of a "non project" to avoid repeated project=
probing on buffers that don't have a project.</div><div class=3D"gmail=
_default" style=3D"font-family:monospace"><br></div><div class=3D"gmail_def=
ault" style=3D"font-family:monospace">I thought maybe I was the only person=
silly enough to invoke costly project functions for every tab in `tab-bar`=
and every mode-line update.</div><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><br></div><div class=3D"gmail_default" style=3D"font-fa=
mily:monospace">I could contribute optional caching to project.el if there =
is sufficient demand for it.=C2=A0 Unless someone else wants to.</div></div=
></div>
--000000000000e1ac4c0635b80bf1--
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Daniel Colascione <dancol@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 22 May 2025 15:55:03 +0000
Resent-Message-ID: <handler.78545.B78545.174792930018216 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: 78545 <at> debbugs.gnu.org, shipmints@HIDDEN, yikai@HIDDEN
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN, Ship Mints <shipmints@HIDDEN>, Yikai Zhao <yikai@HIDDEN>
X-Debbugs-Original-Cc: 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.174792930018216
(code B ref 78545); Thu, 22 May 2025 15:55:03 +0000
Received: (at 78545) by debbugs.gnu.org; 22 May 2025 15:55:00 +0000
Received: from localhost ([127.0.0.1]:36256 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uI8G3-0004jj-Fg
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 11:54:59 -0400
Received: from dancol.org ([2600:3c01:e000:3d8::1]:54974)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <dancol@HIDDEN>) id 1uI8Fr-0004ia-Qy
for 78545 <at> debbugs.gnu.org; Thu, 22 May 2025 11:54:53 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org;
s=x;
h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:
References:In-Reply-To:Subject:CC:To:From:Date:Sender:Reply-To:Content-ID:
Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
List-Post:List-Owner:List-Archive;
bh=dTTZ/dFbLxmawfrRhUhRTK5OSp+5xlMBGpnkjiCZFhk=; b=PwKfNdAjlInQJ6KwLvPWu7iTlS
Wz1Q4hJMTNOMcSXSVy58QPnHozo0yjBb4B8sWVpeNIOGApUy59EqBA6k0TTrzDVibQhtMhKGLgKJO
A6Q6ttIYGXdoFUc4PkqwIXXYN55FMWQhijwE98yE4BZnbTHtALJnlZKwaq968PvaE9XkJP1ae0B7A
Qt9AyLuZOC6yTDLzFyB9XDiwuqmJl5408ijJ70Cqq92ETVDqxSOGzx8O3eNhdHW3qo3qGX7uxwPo1
gwdjqgNceFisSFb8JLUWzFr+5XCcyjFarj/gE3PsLRI/XNOKXX2/1BGzAP2yO7svBaoo9BOwj9g6j
2nrFfuTg==;
Received: from 2603-9001-4203-1ab2-a4db-cc40-dc15-f259.inf6.spectrum.com
([2603:9001:4203:1ab2:a4db:cc40:dc15:f259]:42246 helo=[IPv6:::1])
by dancol.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
(Exim 4.96) (envelope-from <dancol@HIDDEN>) id 1uI8Ek-00AFER-1U;
Thu, 22 May 2025 11:53:38 -0400
Date: Thu, 22 May 2025 11:53:57 -0400
From: Daniel Colascione <dancol@HIDDEN>
User-Agent: K-9 Mail for Android
In-Reply-To: <CAN+1Hbr2z+5cfFz=B0rDyqbvpiVbFODuuDccUyCWP=mSYcWEsw@HIDDEN>
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CAN+1Hbr2z+5cfFz=B0rDyqbvpiVbFODuuDccUyCWP=mSYcWEsw@HIDDEN>
Message-ID: <14B95357-B1E5-4301-AFF9-B5658EDE532E@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On May 22, 2025 7:47:18 AM EDT, Ship Mints <shipmints@gmail=2Ecom> wrote:
>On Thu, May 22, 2025 at 2:17=E2=80=AFAM Yikai Zhao <yikai@z1k=2Edev> wrot=
e:
>
>> After enabling `project-mode-line`, I find my emacs slightly less
>> responsive=2E I think it's because project-mode-line is slow due to
>> it trying to read files on each update=2E Here's how I reproduce it:
>>
>> - Run `emacs -Q`
>> - Evaluate `(setopt project-mode-line t)`
>> - Open some random file in a non-project directory, e=2Eg=2E `/tmp/test=
`,
>> start typing
>>
>> Here's part of the profiling result:
>>
>> 114 62% - redisplay_internal (C function)
>> 42 23% - eval
>> 41 22% - project-mode-line-format
>> 41 22% - project-current
>> 41 22% - project--find-in-directory
>> 41 22% - run-hook-with-args-until-success
>> 41 22% - project-try-vc
>> 41 22% - project-try-vc--search
>> 25 13% - project--value-in-dir
>> 22 12% - hack-dir-local-variables
>> 22 12% - #<byte-code-function 24E>
>> 22 12% - hack-dir-local--get-variables
>> 22 12% - dir-locals-find-file
>> 22 12% - locate-dominating-file
>> 12 6% + abbreviate-file-name
>> 3 1% + #<byte-code-function 98F>
>> 13 7% - locate-dominating-file
>> 6 3% + #<byte-code-function 4D9>
>> 3 1% abbreviate-file-name
>> 3 1%
>>
>> It shows that `project-mode-line-format` can take a significant portion
>> of the redisplay time=2E It increases even more when the directory is d=
eep
>> or the disk is slow=2E
>>
>> IMO the performance of this function should be improved=2E
>>
>> I have two questions:
>>
>> 1=2E Is it possible to simply cache the result as buffer-local?
>> 2=2E IIUC some of the file reading comes from `project--value-in-dir`,
>> which opens a temporary buffer to load dir local variables=2E Why doesn=
't
>> it simply read the variable value in the current buffer?
>>
>
>I've advised project functions to cache the "invariants" current project
>and project root to incur these costs once per buffer=2E I also cache th=
e
>nuance of a "non project" to avoid repeated project probing on buffers th=
at
>don't have a project=2E
>
>I thought maybe I was the only person silly enough to invoke costly proje=
ct
>functions for every tab in `tab-bar` and every mode-line update=2E
>
>I could contribute optional caching to project=2Eel if there is sufficien=
t
>demand for it=2E Unless someone else wants to=2E
We could also just have the IO functions signal error if called during a m=
ode line update=2E
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Daniel Colascione <dancol@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 22 May 2025 15:56:02 +0000
Resent-Message-ID: <handler.78545.B.174792931718680 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: 78545 <at> debbugs.gnu.org, shipmints@HIDDEN, yikai@HIDDEN
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN, Ship Mints <shipmints@HIDDEN>, Yikai Zhao <yikai@HIDDEN>
X-Debbugs-Original-Cc: 78545 <at> debbugs.gnu.org
Received: via spool by submit <at> debbugs.gnu.org id=B.174792931718680
(code B ref -1); Thu, 22 May 2025 15:56:02 +0000
Received: (at submit) by debbugs.gnu.org; 22 May 2025 15:55:17 +0000
Received: from localhost ([127.0.0.1]:36266 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uI8GK-0004rD-Ds
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 11:55:17 -0400
Received: from lists.gnu.org ([2001:470:142::17]:37790)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <dancol@HIDDEN>) id 1uI8G1-0004j2-G0
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 11:54:58 -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 <dancol@HIDDEN>) id 1uI8Fu-0008CX-Tu
for bug-gnu-emacs@HIDDEN; Thu, 22 May 2025 11:54:50 -0400
Received: from dancol.org ([2600:3c01:e000:3d8::1])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <dancol@HIDDEN>) id 1uI8Fs-00056v-K7
for bug-gnu-emacs@HIDDEN; Thu, 22 May 2025 11:54:50 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org;
s=x;
h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:
References:In-Reply-To:Subject:CC:To:From:Date:Sender:Reply-To:Content-ID:
Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
List-Post:List-Owner:List-Archive;
bh=dTTZ/dFbLxmawfrRhUhRTK5OSp+5xlMBGpnkjiCZFhk=; b=PwKfNdAjlInQJ6KwLvPWu7iTlS
Wz1Q4hJMTNOMcSXSVy58QPnHozo0yjBb4B8sWVpeNIOGApUy59EqBA6k0TTrzDVibQhtMhKGLgKJO
A6Q6ttIYGXdoFUc4PkqwIXXYN55FMWQhijwE98yE4BZnbTHtALJnlZKwaq968PvaE9XkJP1ae0B7A
Qt9AyLuZOC6yTDLzFyB9XDiwuqmJl5408ijJ70Cqq92ETVDqxSOGzx8O3eNhdHW3qo3qGX7uxwPo1
gwdjqgNceFisSFb8JLUWzFr+5XCcyjFarj/gE3PsLRI/XNOKXX2/1BGzAP2yO7svBaoo9BOwj9g6j
2nrFfuTg==;
Received: from 2603-9001-4203-1ab2-a4db-cc40-dc15-f259.inf6.spectrum.com
([2603:9001:4203:1ab2:a4db:cc40:dc15:f259]:42246 helo=[IPv6:::1])
by dancol.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
(Exim 4.96) (envelope-from <dancol@HIDDEN>) id 1uI8Ek-00AFER-1U;
Thu, 22 May 2025 11:53:38 -0400
Date: Thu, 22 May 2025 11:53:57 -0400
From: Daniel Colascione <dancol@HIDDEN>
User-Agent: K-9 Mail for Android
In-Reply-To: <CAN+1Hbr2z+5cfFz=B0rDyqbvpiVbFODuuDccUyCWP=mSYcWEsw@HIDDEN>
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CAN+1Hbr2z+5cfFz=B0rDyqbvpiVbFODuuDccUyCWP=mSYcWEsw@HIDDEN>
Message-ID: <14B95357-B1E5-4301-AFF9-B5658EDE532E@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=2600:3c01:e000:3d8::1;
envelope-from=dancol@HIDDEN; helo=dancol.org
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, SPF_HELO_PASS=-0.001,
SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)
On May 22, 2025 7:47:18 AM EDT, Ship Mints <shipmints@gmail=2Ecom> wrote:
>On Thu, May 22, 2025 at 2:17=E2=80=AFAM Yikai Zhao <yikai@z1k=2Edev> wrot=
e:
>
>> After enabling `project-mode-line`, I find my emacs slightly less
>> responsive=2E I think it's because project-mode-line is slow due to
>> it trying to read files on each update=2E Here's how I reproduce it:
>>
>> - Run `emacs -Q`
>> - Evaluate `(setopt project-mode-line t)`
>> - Open some random file in a non-project directory, e=2Eg=2E `/tmp/test=
`,
>> start typing
>>
>> Here's part of the profiling result:
>>
>> 114 62% - redisplay_internal (C function)
>> 42 23% - eval
>> 41 22% - project-mode-line-format
>> 41 22% - project-current
>> 41 22% - project--find-in-directory
>> 41 22% - run-hook-with-args-until-success
>> 41 22% - project-try-vc
>> 41 22% - project-try-vc--search
>> 25 13% - project--value-in-dir
>> 22 12% - hack-dir-local-variables
>> 22 12% - #<byte-code-function 24E>
>> 22 12% - hack-dir-local--get-variables
>> 22 12% - dir-locals-find-file
>> 22 12% - locate-dominating-file
>> 12 6% + abbreviate-file-name
>> 3 1% + #<byte-code-function 98F>
>> 13 7% - locate-dominating-file
>> 6 3% + #<byte-code-function 4D9>
>> 3 1% abbreviate-file-name
>> 3 1%
>>
>> It shows that `project-mode-line-format` can take a significant portion
>> of the redisplay time=2E It increases even more when the directory is d=
eep
>> or the disk is slow=2E
>>
>> IMO the performance of this function should be improved=2E
>>
>> I have two questions:
>>
>> 1=2E Is it possible to simply cache the result as buffer-local?
>> 2=2E IIUC some of the file reading comes from `project--value-in-dir`,
>> which opens a temporary buffer to load dir local variables=2E Why doesn=
't
>> it simply read the variable value in the current buffer?
>>
>
>I've advised project functions to cache the "invariants" current project
>and project root to incur these costs once per buffer=2E I also cache th=
e
>nuance of a "non project" to avoid repeated project probing on buffers th=
at
>don't have a project=2E
>
>I thought maybe I was the only person silly enough to invoke costly proje=
ct
>functions for every tab in `tab-bar` and every mode-line update=2E
>
>I could contribute optional caching to project=2Eel if there is sufficien=
t
>demand for it=2E Unless someone else wants to=2E
We could also just have the IO functions signal error if called during a m=
ode line update=2E
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Kristoffer Balintona <krisbalintona@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 22 May 2025 15:59:02 +0000
Resent-Message-ID: <handler.78545.B78545.174792950719401 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Yikai Zhao <yikai@HIDDEN>, 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.174792950719401
(code B ref 78545); Thu, 22 May 2025 15:59:02 +0000
Received: (at 78545) by debbugs.gnu.org; 22 May 2025 15:58:27 +0000
Received: from localhost ([127.0.0.1]:36291 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uI8JP-00052r-AR
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 11:58:27 -0400
Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]:42185)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <krisbalintona@HIDDEN>)
id 1uI8JK-00052B-Tu
for 78545 <at> debbugs.gnu.org; Thu, 22 May 2025 11:58:23 -0400
Received: by mail-lf1-x133.google.com with SMTP id
2adb3069b0e04-551f0072119so43723e87.0
for <78545 <at> debbugs.gnu.org>; Thu, 22 May 2025 08:58:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1747929496; x=1748534296; darn=debbugs.gnu.org;
h=to:subject:message-id:date:mime-version:references:in-reply-to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=KWhtOrXg7TJFcLbKJK+La+Fmle2MgbWX+iJGHjF/JGk=;
b=CzYSHrNcLhGLhfwyw0qicksyZ3j3Ik4t/aMEwOMC89jXGDDPc2GA0Lhfcf5hNJnMLK
SxQVl7w/inaXyRErPXtjZVEztdWOaiKqZnKJ4HPG1YL4+H1A4nTpVyhuWjNxGkPugJH2
e0o8m2ymdpzjS7n9ePyTMKSTzRNLE5j1MhgFwIeDMZK7/3x6KrS+RYvwXh6pd7FFQVnD
ysmTqRA3g84fOZmEDNzh31lYGALWD2GFl7k0YM2t4ptYfJPsw1JnsDttIdFr9MXTLUWq
qwAXpEWMo5vk2lFpDRPtcv05mHze11++iNjMNeJcoKBd7f4sJMmAkGZ4Pc6XseimJQW7
Lulw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1747929496; x=1748534296;
h=to:subject:message-id:date:mime-version:references:in-reply-to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=KWhtOrXg7TJFcLbKJK+La+Fmle2MgbWX+iJGHjF/JGk=;
b=xDiGpzzEjSxfL+n5MKQIl5MOuObIWYmOBeXIZ6Ow8zEjLu0XVMJRleXRO8B1xb6UXN
ZJ2UbBk3RU+OxWKgC+xnGZo76uPL0mfC4RkdqhJeRQBA0PLO6lDZDVZ/ufZBhrmIGbk/
97j62YPc8nIpLe3AuK5wzvYTdOvbbS4n8KZZWAF7StQsEI7c0LVMXzqUaTgKHLkfSMgJ
45KdbEtZUzpNDY5zS1X06IFujporhWssf0wcLE80LmAGQn7luMaIzvVDH1X/pDgR81Ih
17WxvC6kQdrPRr0sAIPzbaSOXJYZ+tkgh5wnJnaNbkxLcOivaX1a5vMZyDEqi27YpKOQ
5IFw==
X-Forwarded-Encrypted: i=1;
AJvYcCVJ9L9/7iNOe5h/hIBt/iV6aqsULjtqhEkP0186Tdm7KV5i5OApOrDctYyAqsDJSFsDV4ydrw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YznNGqsKOfh1ypcjVmM+9TEIp1jOqy86XaNhlAWqF44/SVpQXJt
bskhRfiDY/df9uAIAz4yoAvIg3b6v7DOlWOEiS57wycEj2TgrkgKUZTMjTzNS38JfabdUbjgRCj
z9RwqHJ+h/GWdZXpE6URiqFkv21ZcXUo=
X-Gm-Gg: ASbGncuX3v2zFQuxT4YoxVqt/wE0PLJ2HnnJTEs/Ny5cmB13Ot6WQraMEyAGOEUNGZ4
qYSmEmA+onS2cYUkSWXhVaNYJczM77hp7DLdiylw/Ntr7XtgKSVNIxv5aARHU1MP5VCPiOPb2wu
O47I5YWCpy586bcSsXgowDsrc6WUrXrVmFt0b95YsjM3M=
X-Google-Smtp-Source: AGHT+IFQ6NhmlMZvVg20fE8uodVKV89fP7EUZ85bCRoiHZfvtVR+jY/VtnbfSHWDtWBkAVKRUggI17b1sbGt+LSTLQQ=
X-Received: by 2002:a05:6512:228a:b0:54a:cc10:1050 with SMTP id
2adb3069b0e04-550e74b46f1mr8421620e87.15.1747929495778; Thu, 22 May 2025
08:58:15 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
HTTPREST; Thu, 22 May 2025 08:58:15 -0700
Received: from 753933720722 named unknown by gmailapi.google.com with
HTTPREST; Thu, 22 May 2025 08:58:15 -0700
From: Kristoffer Balintona <krisbalintona@HIDDEN>
In-Reply-To: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
MIME-Version: 1.0
Date: Thu, 22 May 2025 08:58:15 -0700
X-Gm-Features: AX0GCFsvNvb8eZpzqxEs_F9MyCS4bq44rKg5g-91L3A8IW9InCkZ4MbRt104QTw
Message-ID: <CANVbq5mBC29itcqCsHHy92t3pXfm6C0VBy5uf7aO7sGemBr49g@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On Thu, May 22 2025, Yikai Zhao wrote:
> After enabling `project-mode-line`, I find my emacs slightly less
> responsive. I think it's because project-mode-line is slow due to
> it trying to read files on each update. Here's how I reproduce it:
>
> - Run `emacs -Q`
> - Evaluate `(setopt project-mode-line t)`
> - Open some random file in a non-project directory, e.g. `/tmp/test`,
> start typing
>
> Here's part of the profiling result:
>
> 114 62% - redisplay_internal (C function)
> 42 23% - eval
> 41 22% - project-mode-line-format
> 41 22% - project-current
> 41 22% - project--find-in-directory
> 41 22% - run-hook-with-args-until-success
> 41 22% - project-try-vc
> 41 22% - project-try-vc--search
> 25 13% - project--value-in-dir
> 22 12% - hack-dir-local-variables
> 22 12% - #<byte-code-function 24E>
> 22 12% - hack-dir-local--get-variables
> 22 12% - dir-locals-find-file
> 22 12% - locate-dominating-file
> 12 6% + abbreviate-file-name
> 3 1% + #<byte-code-function 98F>
> 13 7% - locate-dominating-file
> 6 3% + #<byte-code-function 4D9>
> 3 1% abbreviate-file-name
> 3 1%
>
> It shows that `project-mode-line-format` can take a significant portion
> of the redisplay time. It increases even more when the directory is deep
> or the disk is slow.
>
> IMO the performance of this function should be improved.
>
> I have two questions:
>
> 1. Is it possible to simply cache the result as buffer-local?
> 2. IIUC some of the file reading comes from `project--value-in-dir`,
> which opens a temporary buffer to load dir local variables. Why doesn't
> it simply read the variable value in the current buffer?
>
I experienced similar, actually, on Nix where the Emacs source files,
having been built in the special Nix store, are somewhere deep under
/nix/store/. I suspected it was project.el trying to find a root. I
never got around to confirming it nor finding a fix.
--
In gratitude,
Kristoffer
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Ship Mints <shipmints@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 22 May 2025 16:24:02 +0000
Resent-Message-ID: <handler.78545.B78545.174793101327125 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Kristoffer Balintona <krisbalintona@HIDDEN>
Cc: Yikai Zhao <yikai@HIDDEN>, 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.174793101327125
(code B ref 78545); Thu, 22 May 2025 16:24:02 +0000
Received: (at 78545) by debbugs.gnu.org; 22 May 2025 16:23:33 +0000
Received: from localhost ([127.0.0.1]:36462 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uI8hg-00073Q-H1
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 12:23:33 -0400
Received: from mail-ua1-x934.google.com ([2607:f8b0:4864:20::934]:46129)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
id 1uI8hV-000729-5o
for 78545 <at> debbugs.gnu.org; Thu, 22 May 2025 12:23:28 -0400
Received: by mail-ua1-x934.google.com with SMTP id
a1e0cc1a2514c-87bf51f7225so3221048241.0
for <78545 <at> debbugs.gnu.org>; Thu, 22 May 2025 09:23:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1747930995; x=1748535795; darn=debbugs.gnu.org;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=AsZRXBlR1U/IlKYXUY+FaCA2bATf6uEzwtbH5NWkcnc=;
b=BCR9fvL219QOXIBgcdCZEGqs7n8rVtkEIsgNeyJL21GuYH+prBfx4cI5eT6yqMCCvz
1ipXV/PSg9lEo19rDjWmrNEILGczf52cdo80va3F3hriTfzcrk13zMbJp4D6C0IsPTBt
pnACkj5/JTT7G9HRnYnIk8Op5Wm38dOQtL71cQJOLKqzy6h6XYHCGD+PQpP0mDVt/8mY
UC6cUnxcLLxftRe6tIDYxpyb+RAB6mtJWiF/KGewA4FblJTz8CXfSWhHOthx3eGI68RC
nsdTvedkQcd7uiufNO2DmFgKhMwJUqSGqeiECR30EETXK6Nh7O5Rdek4kWS1cD+HVCm/
l8gw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1747930995; x=1748535795;
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=AsZRXBlR1U/IlKYXUY+FaCA2bATf6uEzwtbH5NWkcnc=;
b=bBCJhYs0hi+wvNgJAIhIC1EbfpHmS7HR39xeiUaMY0N7W9qMfSO8d+QqEj1Ica5xwK
feWd6h9I8LV86ksvaYT6+cXdk9VdQJqORGOCgLanYll7VJV4pwc5RwTq8AYIIQGB6OLJ
yRRFzihe3x6hpeCseHhEvP7/CUsr/JjGMYc230R1bFmgjjlskyT05VFp6u8psCErMOTF
AAJwe1NJSJDPW02ML1lzlVetu3k6s20fUcufKhiQIUl55NEeRy4LT3Q71WnY/nrYVBwg
e1sDht277IYtmi6vDaJJf/3Zc6OAgLg90bQRHc2hb4FiS8VEDTeeeRfKQ6+Ez4z2bsBt
V3Zg==
X-Forwarded-Encrypted: i=1;
AJvYcCXeU1Ro+MezNmCE0DBrwTpm/Mj5ABsPKScVx1zMWv/S5szSkQ6XEYv44NedT4tutV6mbivCqg==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzE2qWQE3F7cOA4hobZWHI+CYfIY4sL2ajBjjNJEbpfqYS9Jc4r
Ggm8vPMvpIgEzuOv7cBgqpKtJloWq7nP7LGzb/vuBKhxbSlnuBC6R2iKfry81WW5C3F03Aq2IgK
8WqlscGEdifdqI/BeTZ8Kw+0F9fYVTVs=
X-Gm-Gg: ASbGnct+JMvnwL2FB35Sa+wNPqfBKmLQWf6gCAov9Hi5TI4rETQlw/YJoDAEcaCy6cQ
OHCIbulekXPCUz/diEBOAdJGLHGVEcgNAkjZ1tDMsdQP75h9omyYxPZNHKtCVovfEJBX6IJcF2Z
WnRDGA2tzJjX0OgoNrGmWUiavUlq0HQx5DDVw=
X-Google-Smtp-Source: AGHT+IHpkne3pHepm6NBkowEcOzUtaJvSP6OeGe3HtKlvsu788F51xrBVM0rtJRelg+/1umh565degVKciWY+YVgcRU=
X-Received: by 2002:a05:6102:3f9f:b0:4bb:e80b:473d with SMTP id
ada2fe7eead31-4dfa6b6c352mr22976093137.6.1747930994854; Thu, 22 May 2025
09:23:14 -0700 (PDT)
MIME-Version: 1.0
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CANVbq5mBC29itcqCsHHy92t3pXfm6C0VBy5uf7aO7sGemBr49g@HIDDEN>
In-Reply-To: <CANVbq5mBC29itcqCsHHy92t3pXfm6C0VBy5uf7aO7sGemBr49g@HIDDEN>
From: Ship Mints <shipmints@HIDDEN>
Date: Thu, 22 May 2025 12:23:01 -0400
X-Gm-Features: AX0GCFvQjwu780cIsd8Q2BCbhySZKQuAIO0wh7_B9Rx9m0kKJGCpQbikghzVn9s
Message-ID: <CAN+1Hbr9zq9qO7GQeBtCJyfVCcbzLQE33_7r2WTLzZgP2eey7g@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000000a4f960635bbe614"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
--0000000000000a4f960635bbe614
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Thu, May 22, 2025 at 11:59=E2=80=AFAM Kristoffer Balintona <
krisbalintona@HIDDEN> wrote:
> On Thu, May 22 2025, Yikai Zhao wrote:
>
> > After enabling `project-mode-line`, I find my emacs slightly less
> > responsive. I think it's because project-mode-line is slow due to
> > it trying to read files on each update. Here's how I reproduce it:
> >
> > - Run `emacs -Q`
> > - Evaluate `(setopt project-mode-line t)`
> > - Open some random file in a non-project directory, e.g. `/tmp/test`,
> > start typing
> >
> > Here's part of the profiling result:
> >
> > 114 62% - redisplay_internal (C function)
> > 42 23% - eval
> > 41 22% - project-mode-line-format
> > 41 22% - project-current
> > 41 22% - project--find-in-directory
> > 41 22% - run-hook-with-args-until-success
> > 41 22% - project-try-vc
> > 41 22% - project-try-vc--search
> > 25 13% - project--value-in-dir
> > 22 12% - hack-dir-local-variables
> > 22 12% - #<byte-code-function 24E>
> > 22 12% - hack-dir-local--get-variables
> > 22 12% - dir-locals-find-file
> > 22 12% - locate-dominating-file
> > 12 6% + abbreviate-file-name
> > 3 1% + #<byte-code-function 98F>
> > 13 7% - locate-dominating-file
> > 6 3% + #<byte-code-function 4D9>
> > 3 1% abbreviate-file-name
> > 3 1%
> >
> > It shows that `project-mode-line-format` can take a significant portion
> > of the redisplay time. It increases even more when the directory is dee=
p
> > or the disk is slow.
> >
> > IMO the performance of this function should be improved.
> >
> > I have two questions:
> >
> > 1. Is it possible to simply cache the result as buffer-local?
> > 2. IIUC some of the file reading comes from `project--value-in-dir`,
> > which opens a temporary buffer to load dir local variables. Why doesn't
> > it simply read the variable value in the current buffer?
> >
>
> I experienced similar, actually, on Nix where the Emacs source files,
> having been built in the special Nix store, are somewhere deep under
> /nix/store/. I suspected it was project.el trying to find a root. I
> never got around to confirming it nor finding a fix.
>
I'm taking some time today to rework my approach rather than use advice.
That was hacky, and good enough for personal use to scratch an immediate
itch. If this comes out well, I'll propose a project.el patch and see what
people think.
Daniel, I'm not so sure about blocking all IO in mode-line updates. That
sounds like it will surprise a lot of people.
-Stephane
--0000000000000a4f960635bbe614
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Thu, May 22, 2025 at 11:59=E2=80=AFAM Kristoffer Balintona <<a href=
=3D"mailto:krisbalintona@HIDDEN">krisbalintona@HIDDEN</a>> wrote:<=
/span></div></div><div class=3D"gmail_quote gmail_quote_container"><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px=
solid rgb(204,204,204);padding-left:1ex">On Thu, May 22 2025, Yikai Zhao w=
rote:<br>
<br>
> After enabling `project-mode-line`, I find my emacs slightly less<br>
> responsive. I think it's because project-mode-line is slow due to<=
br>
> it trying to read files on each update. Here's how I reproduce it:=
<br>
><br>
> - Run `emacs -Q`<br>
> - Evaluate `(setopt project-mode-line t)`<br>
> - Open some random file in a non-project directory, e.g. `/tmp/test`,<=
br>
> start typing<br>
><br>
> Here's part of the profiling result:<br>
><br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 114=C2=A0 62% - redisplay_internal (=
C function)<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A042=C2=A0 23%=C2=A0 - eval<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0- pro=
ject-mode-line-format<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 - pr=
oject-current<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 =C2=
=A0- project--find-in-directory<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 =C2=
=A0 - run-hook-with-args-until-success<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 =C2=
=A0 =C2=A0- project-try-vc<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 - project-try-vc--search<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A025=C2=A0 13%=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0- project--value-in-dir<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 - hack-dir-local-variables<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0- #<byte-code-function 24E><br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 - hack-dir-local--get-variables<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- dir-locals-find-file<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 - locate-dominating-file<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A012=C2=A0 =C2=A06%=C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ abbreviate-file-name<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 3=C2=A0 =C2=A01%=C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 + #<byte-code-function 98F><br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A013=C2=A0 =C2=A07%=C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0- locate-dominating-file<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 6=C2=A0 =C2=A03%=C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 + #<byte-code-function 4D9><br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 3=C2=A0 =C2=A01%=C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 abbreviate-file-name<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 3=C2=A0 =C2=A01%<br>
><br>
> It shows that `project-mode-line-format` can take a significant portio=
n<br>
> of the redisplay time. It increases even more when the directory is de=
ep<br>
> or the disk is slow.<br>
><br>
> IMO the performance of this function should be improved.<br>
><br>
> I have two questions:<br>
><br>
> 1. Is it possible to simply cache the result as buffer-local?<br>
> 2. IIUC some of the file reading comes from `project--value-in-dir`,<b=
r>
> which opens a temporary buffer to load dir local variables. Why doesn&=
#39;t<br>
> it simply read the variable value in the current buffer?<br>
><br>
<br>
I experienced similar, actually, on Nix where the Emacs source files,<br>
having been built in the special Nix store, are somewhere deep under<br>
/nix/store/. I suspected it was project.el trying to find a root. I<br>
never got around to confirming it nor finding a fix.<br></blockquote><div><=
br></div><div class=3D"gmail_default" style=3D"font-family:monospace">I'=
;m taking some time today to rework my approach rather than use advice.=C2=
=A0 That was hacky, and good enough for personal use to scratch an immediat=
e itch.=C2=A0 If this comes out well, I'll propose a project.el patch a=
nd see what people think.</div><div class=3D"gmail_default" style=3D"font-f=
amily:monospace"><br></div><div class=3D"gmail_default" style=3D"font-famil=
y:monospace">Daniel, I'm not so sure about blocking all IO in mode-line=
updates.=C2=A0 That sounds like it will surprise a lot of people.</div><di=
v class=3D"gmail_default" style=3D"font-family:monospace"><br></div><div cl=
ass=3D"gmail_default" style=3D"font-family:monospace">-Stephane</div></div>=
</div>
--0000000000000a4f960635bbe614--
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Yikai Zhao <yikai@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 22 May 2025 17:03:03 +0000
Resent-Message-ID: <handler.78545.B.17479333568119 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Daniel Colascione <dancol@HIDDEN>
Cc: 78545 <at> debbugs.gnu.org, shipmints@HIDDEN
X-Debbugs-Original-Cc: bug-gnu-emacs@HIDDEN, 78545 <at> debbugs.gnu.org, Ship Mints <shipmints@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.17479333568119
(code B ref -1); Thu, 22 May 2025 17:03:03 +0000
Received: (at submit) by debbugs.gnu.org; 22 May 2025 17:02:36 +0000
Received: from localhost ([127.0.0.1]:36831 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uI9JT-00026s-VD
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 13:02:36 -0400
Received: from lists.gnu.org ([2001:470:142::17]:53302)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <i@HIDDEN>) id 1uI9JK-00025E-Eh
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 13:02:31 -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 <i@HIDDEN>) id 1uI9JC-0003dr-W4
for bug-gnu-emacs@HIDDEN; Thu, 22 May 2025 13:02:19 -0400
Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from <i@HIDDEN>) id 1uI9JA-00082l-MA
for bug-gnu-emacs@HIDDEN; Thu, 22 May 2025 13:02:18 -0400
Received: by mail-wr1-x430.google.com with SMTP id
ffacd0b85a97d-3a365a6804eso3665319f8f.3
for <bug-gnu-emacs@HIDDEN>; Thu, 22 May 2025 10:02:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=z1k.dev; s=google; t=1747933334; x=1748538134; darn=gnu.org;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=WTZTn79E+EM667NFaY5bkgqYEdedNdxRLkSPnSqPFHw=;
b=Zgu3Mr4ot8zbpNJ2InTOBAYNPvzJZD+ogSs8NogLbwyuMr/Jj084S2rtkS9DJ5+WCv
0oicWOARkZOk74EoQ8wWimZMVunbB+e7RJeXZB+erOiPMp0dkHWzfDXOqfg69JdoWFFM
NogPvfHHgOh5o3Pc/EOBcLXDjqbBZfxdV5kC9TteUbreO57GqZhTyvrYgFhVkUTtuLEm
shOCgMXtvbhpazWdBHOVxsOqOOPKX435fhJB1CtxmSvbrOFRT4Xn7cIrWZlp7TRUlycL
Bv+iX3wCg8JnloFGLcRyiG1RDikkKgr+yK5IOyQk1kB2lEct08FUXHk8fyFa00dIaESs
Kx9A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1747933334; x=1748538134;
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=WTZTn79E+EM667NFaY5bkgqYEdedNdxRLkSPnSqPFHw=;
b=WolWrFS9uBULswhILWz+8vHjPMG2p5r5J64JzKvOfgiFFQLhYTC/FEYPlvlDe3USO9
7LLIfbymorEcmd6xUZGw9pfyMay49btQEuunob4cjfalGsfFXYs5Trfek5qa7gVgIY65
jtfliyarA6GaAcVi6e6ObgINn9LXhFENZePF8j0V7bfutFHgEnaptil31LtXF4t0xQZ/
LmCrx982plxL8IV0y4yEuz2SccCer1I6hCZysmJWiepmV4zu2zildpLRjsaxvhOJdHFN
IO0sV3wVcgfqAErX8VyO9T27SJKzw5clJ3PucRNyH9VltjYSkwm68TiKNWTLXOIWLx7X
PUEw==
X-Gm-Message-State: AOJu0YzvG2mAMK+KKW5zz03K22VRj5x1qdJK5Xz1PihPPxsPz0FrDpic
zwdUxOBGd2v9Wv8LGJzJaObjK4npYESos5SA7xvXgpU8jWUp75qp2rrrfAP3mb5vP7Cf+v/Eze2
BY6ko/XvdmGhv9zCTamo8ZJ0rX4HxzSU8mZ0J2bc53w==
X-Gm-Gg: ASbGncsJPYE4ZTV01P3djvvQOBVcdnUP+7Qubb6bbfMpCXJHf6C1D7TZCkGMG2N7pNs
rxHGwMbo+B9T/iw5E1dQcRR43FFP/ZQuqJ6qaQxhZfwGF58EmqcLQZoeSF5Lui/Z/tvm97Q16cx
Ji5/Bn9HNGuT0qR+RnVpKQLnz+C7cG/QHXn5rm9UrTHUubGV6BtBfumvgUVZ0idSb9wIY=
X-Google-Smtp-Source: AGHT+IFtrFWVi9TYVJpc7ePKGED2hApw+e+nHAQENF5F5bZU7g6ofQwLJzRsdZzRatKck3xNFjHdQOGZ1XB9QG2Z6P0=
X-Received: by 2002:a5d:64ee:0:b0:3a0:b72a:b36 with SMTP id
ffacd0b85a97d-3a35c84bd82mr22632094f8f.36.1747933334035; Thu, 22 May 2025
10:02:14 -0700 (PDT)
MIME-Version: 1.0
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CAN+1Hbr2z+5cfFz=B0rDyqbvpiVbFODuuDccUyCWP=mSYcWEsw@HIDDEN>
<14B95357-B1E5-4301-AFF9-B5658EDE532E@HIDDEN>
In-Reply-To: <14B95357-B1E5-4301-AFF9-B5658EDE532E@HIDDEN>
From: Yikai Zhao <yikai@HIDDEN>
Date: Fri, 23 May 2025 01:02:02 +0800
X-Gm-Features: AX0GCFsHUq8LjzkPbRjWJG6RigaqUN0PmpzoyiFav8W85nqwwzuKh8w83yz3DEw
Message-ID: <CANMyjpj534R+CxiRzk0ht9fv2aeraFn+4EuPmtboYtyRdNOFZQ@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000007777600635bc7173"
Received-SPF: pass client-ip=2a00:1450:4864:20::430;
envelope-from=i@HIDDEN; helo=mail-wr1-x430.google.com
X-Spam_score_int: -19
X-Spam_score: -2.0
X-Spam_bar: --
X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001,
HTML_MESSAGE=0.001, 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-Spam-Score: 1.0 (+)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)
--0000000000007777600635bc7173
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Thu, May 22, 2025 at 23:54 Daniel Colascione <dancol@HIDDEN> wrote:
>
>
> On May 22, 2025 7:47:18 AM EDT, Ship Mints <shipmints@HIDDEN> wrote:
> >On Thu, May 22, 2025 at 2:17=E2=80=AFAM Yikai Zhao <yikai@HIDDEN> wrote=
:
> >
> >> After enabling `project-mode-line`, I find my emacs slightly less
> >> responsive. I think it's because project-mode-line is slow due to
> >> it trying to read files on each update. Here's how I reproduce it:
> >>
> >> - Run `emacs -Q`
> >> - Evaluate `(setopt project-mode-line t)`
> >> - Open some random file in a non-project directory, e.g. `/tmp/test`,
> >> start typing
> >>
> >> Here's part of the profiling result:
> >>
> >> 114 62% - redisplay_internal (C function)
> >> 42 23% - eval
> >> 41 22% - project-mode-line-format
> >> 41 22% - project-current
> >> 41 22% - project--find-in-directory
> >> 41 22% - run-hook-with-args-until-success
> >> 41 22% - project-try-vc
> >> 41 22% - project-try-vc--search
> >> 25 13% - project--value-in-dir
> >> 22 12% - hack-dir-local-variables
> >> 22 12% - #<byte-code-function 24E>
> >> 22 12% - hack-dir-local--get-variables
> >> 22 12% - dir-locals-find-file
> >> 22 12% - locate-dominating-file
> >> 12 6% + abbreviate-file-name
> >> 3 1% + #<byte-code-function 98F>
> >> 13 7% - locate-dominating-file
> >> 6 3% + #<byte-code-function 4D9>
> >> 3 1% abbreviate-file-name
> >> 3 1%
> >>
> >> It shows that `project-mode-line-format` can take a significant portio=
n
> >> of the redisplay time. It increases even more when the directory is de=
ep
> >> or the disk is slow.
> >>
> >> IMO the performance of this function should be improved.
> >>
> >> I have two questions:
> >>
> >> 1. Is it possible to simply cache the result as buffer-local?
> >> 2. IIUC some of the file reading comes from `project--value-in-dir`,
> >> which opens a temporary buffer to load dir local variables. Why doesn'=
t
> >> it simply read the variable value in the current buffer?
> >>
> >
> >I've advised project functions to cache the "invariants" current project
> >and project root to incur these costs once per buffer. I also cache the
> >nuance of a "non project" to avoid repeated project probing on buffers
> that
> >don't have a project.
> >
> >I thought maybe I was the only person silly enough to invoke costly
> project
> >functions for every tab in `tab-bar` and every mode-line update.
> >
> >I could contribute optional caching to project.el if there is sufficient
> >demand for it. Unless someone else wants to.
>
> We could also just have the IO functions signal error if called during a
> mode line update.
Personally I think this is a great idea. Aside from mode line updates, IO
functions can cause undesired delay in many other functions (like tab bar
or maybe post command hook). If we have a general way to mark certain hooks
as =E2=80=9Cshould not block by IO=E2=80=9D and be able to capture those vi=
olations, it
would be very helpful.
Yikai
>
--0000000000007777600635bc7173
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div><br></div><div><br><div class=3D"gmail_quote gmail_quote_container"><d=
iv dir=3D"ltr" class=3D"gmail_attr">On Thu, May 22, 2025 at 23:54 Daniel Co=
lascione <<a href=3D"mailto:dancol@HIDDEN">dancol@HIDDEN</a>>=
wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;bo=
rder-left-color:rgb(204,204,204)"><br>
<br>
On May 22, 2025 7:47:18 AM EDT, Ship Mints <<a href=3D"mailto:shipmints@=
gmail.com" target=3D"_blank">shipmints@HIDDEN</a>> wrote:<br>
>On Thu, May 22, 2025 at 2:17=E2=80=AFAM Yikai Zhao <<a href=3D"mailt=
o:yikai@HIDDEN" target=3D"_blank">yikai@HIDDEN</a>> wrote:<br>
><br>
>> After enabling `project-mode-line`, I find my emacs slightly less<=
br>
>> responsive. I think it's because project-mode-line is slow due=
to<br>
>> it trying to read files on each update. Here's how I reproduce=
it:<br>
>><br>
>> - Run `emacs -Q`<br>
>> - Evaluate `(setopt project-mode-line t)`<br>
>> - Open some random file in a non-project directory, e.g. `/tmp/tes=
t`,<br>
>> start typing<br>
>><br>
>> Here's part of the profiling result:<br>
>><br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 114=C2=A0 62% - redisplay_intern=
al (C function)<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A042=C2=A0 23%=C2=A0 - eval<=
br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0-=
project-mode-line-format<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 =
- project-current<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 =
=C2=A0- project--find-in-directory<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 =
=C2=A0 - run-hook-with-args-until-success<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0- project-try-vc<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 - project-try-vc--search<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A025=C2=A0 13%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0- project--value-in-dir<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 - hack-dir-local-variables<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0- #<byte-code-function 24E><br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 - hack-dir-local--get-variables<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- dir-locals-find-file<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 - locate-dominating-file<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A012=C2=A0 =C2=A06%=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ abbreviate-file-name<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 3=C2=A0 =C2=A01%=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 + #<byte-code-function 98F><br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A013=C2=A0 =C2=A07%=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0- locate-dominating-file<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 6=C2=A0 =C2=A03%=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 + #<byte-code-function 4D9><br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 3=C2=A0 =C2=A01%=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 abbreviate-file-name<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 3=C2=A0 =C2=A01%<br>
>><br>
>> It shows that `project-mode-line-format` can take a significant po=
rtion<br>
>> of the redisplay time. It increases even more when the directory i=
s deep<br>
>> or the disk is slow.<br>
>><br>
>> IMO the performance of this function should be improved.<br>
>><br>
>> I have two questions:<br>
>><br>
>> 1. Is it possible to simply cache the result as buffer-local?<br>
>> 2. IIUC some of the file reading comes from `project--value-in-dir=
`,<br>
>> which opens a temporary buffer to load dir local variables. Why do=
esn't<br>
>> it simply read the variable value in the current buffer?<br>
>><br>
><br>
>I've advised project functions to cache the "invariants" =
current project<br>
>and project root to incur these costs once per buffer.=C2=A0 I also cac=
he the<br>
>nuance of a "non project" to avoid repeated project probing o=
n buffers that<br>
>don't have a project.<br>
><br>
>I thought maybe I was the only person silly enough to invoke costly pro=
ject<br>
>functions for every tab in `tab-bar` and every mode-line update.<br>
><br>
>I could contribute optional caching to project.el if there is sufficien=
t<br>
>demand for it.=C2=A0 Unless someone else wants to.<br>
<br>
We could also just have the IO functions signal error if called during a mo=
de line update.</blockquote><div dir=3D"auto"><br></div><div dir=3D"auto">P=
ersonally I think this is a great idea. Aside from mode line updates, IO fu=
nctions can cause undesired delay in=C2=A0many other functions (like tab ba=
r or maybe post command hook). If we have a general way to mark certain hoo=
ks as =E2=80=9Cshould not block by IO=E2=80=9D and be able to capture those=
violations,=C2=A0it would be very helpful.=C2=A0</div><div dir=3D"auto"><b=
r></div><div dir=3D"auto"><br></div><div dir=3D"auto">Yikai</div><div dir=
=3D"auto"><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0=
px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex=
;border-left-color:rgb(204,204,204)" dir=3D"auto"><br>
</blockquote></div></div>
--0000000000007777600635bc7173--
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Yikai Zhao <yikai@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 22 May 2025 17:03:05 +0000
Resent-Message-ID: <handler.78545.B78545.17479333468056 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Daniel Colascione <dancol@HIDDEN>
Cc: 78545 <at> debbugs.gnu.org, shipmints@HIDDEN
X-Debbugs-Original-Cc: bug-gnu-emacs@HIDDEN, 78545 <at> debbugs.gnu.org, Ship Mints <shipmints@HIDDEN>
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.17479333468056
(code B ref 78545); Thu, 22 May 2025 17:03:05 +0000
Received: (at 78545) by debbugs.gnu.org; 22 May 2025 17:02:26 +0000
Received: from localhost ([127.0.0.1]:36828 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uI9JJ-00025l-4E
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 13:02:26 -0400
Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:48153)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <i@HIDDEN>) id 1uI9JE-000252-M6
for 78545 <at> debbugs.gnu.org; Thu, 22 May 2025 13:02:21 -0400
Received: by mail-wr1-x432.google.com with SMTP id
ffacd0b85a97d-3a36e950e41so3234732f8f.0
for <78545 <at> debbugs.gnu.org>; Thu, 22 May 2025 10:02:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=z1k.dev; s=google; t=1747933334; x=1748538134; darn=debbugs.gnu.org;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=WTZTn79E+EM667NFaY5bkgqYEdedNdxRLkSPnSqPFHw=;
b=bRyR49AJvFMV49S0BjH3KD4HgpE79M1GXO8riic8M2uGCVvsR/y105+Rda6Gxk2LdK
IB/yupi2s7S5XkuhdhW6r3FdNRMD0HZA9LForxaSpGogAotsEULtiAzb7OMyaNe7xYui
OWr6/kA+p5ZL+uoQhZLUJhYjbrp1zC9p+QfHNUUIfaZtsI2HXJNwEN4EB4L+ho9qGIq2
hbcbIvoH91mtmDLaW9cQCYAqo3mFH5M26M0dbOLyqQlxTTNhowb66Lr+Q9tZQ/MX/txP
hWLSmfgOTYvln7gnz7YFyWYGKu8Mdnd4v/3wfQAZnogPG9hoCv6UZ2TFONmUjQL9iCCE
OZ4A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1747933334; x=1748538134;
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=WTZTn79E+EM667NFaY5bkgqYEdedNdxRLkSPnSqPFHw=;
b=uoJObros+w+DAcdVnXOa8Oe1a8RGSOUrRfYafcZC1TUb77HvYQmbxvkc2PzgV4NiJp
QHa4vMoNsL1AxHnkbFsSRa6WFLvlmj/QcPlTFvSR3dsTJodTijDjzPYS/qHGSgOk1Vpc
rN2nMfRXbjOMFHk4wuCjv7bP82oqJaFkBWoCdrVtaHltgAyt1Q0iB3XtGYc6FbBx68gu
lv1OlogBNdq93H4hn5SXfSPgSyKwghVzanhJ6E3GoDHsTTGR/xbM97XYcD9CBUuXdUgM
9TiPoeli2fGrWM926iI+IHlLiyj++LRv+uX+LEnADZMq48ZSaMl1UEC8UoHnecmFW33r
WMGw==
X-Forwarded-Encrypted: i=1;
AJvYcCXmt+pGAc1Eprc6IGG4CrpqZcD4TOg64I+aedENpFi09aBum6TM51euV7AUjC54baFHUDbv2w==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yy0PZJ4P8kBYxv60thNmr7Ho23XK/w4ryTHQritNQMuT+0gv9kq
uGrXJV5MlhBnqNOcJ9dAIL5/5WdCNFRyfCaOxVXuKkLQfFkXDNrmCwrz4Nz+7EGbPQk4YepPQAe
e9SYsvp1y35X3PEvFHuzoQlE9ygBbeDbP650UDJ37Tw==
X-Gm-Gg: ASbGncvg8QIMIOyNXWVR/UfuE9Ops0Hq8jTgMMIm1cEJT+eCTXTrIuuE6PBD1ixd1EM
1CMlQpUfTbA2lrPUvA/NX8hErgVsHzraQ/zDvW+HVG5tYmmeqZ1s1R8RH9+xAFkEpE1HRnjovG+
clqP+/s4oNOUMnJxXQxi6oTXusgnDorHpcJeNT+K22yiBJfFYw0BUWxrn+wa8eMtvvN7s=
X-Google-Smtp-Source: AGHT+IFtrFWVi9TYVJpc7ePKGED2hApw+e+nHAQENF5F5bZU7g6ofQwLJzRsdZzRatKck3xNFjHdQOGZ1XB9QG2Z6P0=
X-Received: by 2002:a5d:64ee:0:b0:3a0:b72a:b36 with SMTP id
ffacd0b85a97d-3a35c84bd82mr22632094f8f.36.1747933334035; Thu, 22 May 2025
10:02:14 -0700 (PDT)
MIME-Version: 1.0
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CAN+1Hbr2z+5cfFz=B0rDyqbvpiVbFODuuDccUyCWP=mSYcWEsw@HIDDEN>
<14B95357-B1E5-4301-AFF9-B5658EDE532E@HIDDEN>
In-Reply-To: <14B95357-B1E5-4301-AFF9-B5658EDE532E@HIDDEN>
From: Yikai Zhao <yikai@HIDDEN>
Date: Fri, 23 May 2025 01:02:02 +0800
X-Gm-Features: AX0GCFsHUq8LjzkPbRjWJG6RigaqUN0PmpzoyiFav8W85nqwwzuKh8w83yz3DEw
Message-ID: <CANMyjpj534R+CxiRzk0ht9fv2aeraFn+4EuPmtboYtyRdNOFZQ@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000007777600635bc7173"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
--0000000000007777600635bc7173
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Thu, May 22, 2025 at 23:54 Daniel Colascione <dancol@HIDDEN> wrote:
>
>
> On May 22, 2025 7:47:18 AM EDT, Ship Mints <shipmints@HIDDEN> wrote:
> >On Thu, May 22, 2025 at 2:17=E2=80=AFAM Yikai Zhao <yikai@HIDDEN> wrote=
:
> >
> >> After enabling `project-mode-line`, I find my emacs slightly less
> >> responsive. I think it's because project-mode-line is slow due to
> >> it trying to read files on each update. Here's how I reproduce it:
> >>
> >> - Run `emacs -Q`
> >> - Evaluate `(setopt project-mode-line t)`
> >> - Open some random file in a non-project directory, e.g. `/tmp/test`,
> >> start typing
> >>
> >> Here's part of the profiling result:
> >>
> >> 114 62% - redisplay_internal (C function)
> >> 42 23% - eval
> >> 41 22% - project-mode-line-format
> >> 41 22% - project-current
> >> 41 22% - project--find-in-directory
> >> 41 22% - run-hook-with-args-until-success
> >> 41 22% - project-try-vc
> >> 41 22% - project-try-vc--search
> >> 25 13% - project--value-in-dir
> >> 22 12% - hack-dir-local-variables
> >> 22 12% - #<byte-code-function 24E>
> >> 22 12% - hack-dir-local--get-variables
> >> 22 12% - dir-locals-find-file
> >> 22 12% - locate-dominating-file
> >> 12 6% + abbreviate-file-name
> >> 3 1% + #<byte-code-function 98F>
> >> 13 7% - locate-dominating-file
> >> 6 3% + #<byte-code-function 4D9>
> >> 3 1% abbreviate-file-name
> >> 3 1%
> >>
> >> It shows that `project-mode-line-format` can take a significant portio=
n
> >> of the redisplay time. It increases even more when the directory is de=
ep
> >> or the disk is slow.
> >>
> >> IMO the performance of this function should be improved.
> >>
> >> I have two questions:
> >>
> >> 1. Is it possible to simply cache the result as buffer-local?
> >> 2. IIUC some of the file reading comes from `project--value-in-dir`,
> >> which opens a temporary buffer to load dir local variables. Why doesn'=
t
> >> it simply read the variable value in the current buffer?
> >>
> >
> >I've advised project functions to cache the "invariants" current project
> >and project root to incur these costs once per buffer. I also cache the
> >nuance of a "non project" to avoid repeated project probing on buffers
> that
> >don't have a project.
> >
> >I thought maybe I was the only person silly enough to invoke costly
> project
> >functions for every tab in `tab-bar` and every mode-line update.
> >
> >I could contribute optional caching to project.el if there is sufficient
> >demand for it. Unless someone else wants to.
>
> We could also just have the IO functions signal error if called during a
> mode line update.
Personally I think this is a great idea. Aside from mode line updates, IO
functions can cause undesired delay in many other functions (like tab bar
or maybe post command hook). If we have a general way to mark certain hooks
as =E2=80=9Cshould not block by IO=E2=80=9D and be able to capture those vi=
olations, it
would be very helpful.
Yikai
>
--0000000000007777600635bc7173
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div><br></div><div><br><div class=3D"gmail_quote gmail_quote_container"><d=
iv dir=3D"ltr" class=3D"gmail_attr">On Thu, May 22, 2025 at 23:54 Daniel Co=
lascione <<a href=3D"mailto:dancol@HIDDEN">dancol@HIDDEN</a>>=
wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;bo=
rder-left-color:rgb(204,204,204)"><br>
<br>
On May 22, 2025 7:47:18 AM EDT, Ship Mints <<a href=3D"mailto:shipmints@=
gmail.com" target=3D"_blank">shipmints@HIDDEN</a>> wrote:<br>
>On Thu, May 22, 2025 at 2:17=E2=80=AFAM Yikai Zhao <<a href=3D"mailt=
o:yikai@HIDDEN" target=3D"_blank">yikai@HIDDEN</a>> wrote:<br>
><br>
>> After enabling `project-mode-line`, I find my emacs slightly less<=
br>
>> responsive. I think it's because project-mode-line is slow due=
to<br>
>> it trying to read files on each update. Here's how I reproduce=
it:<br>
>><br>
>> - Run `emacs -Q`<br>
>> - Evaluate `(setopt project-mode-line t)`<br>
>> - Open some random file in a non-project directory, e.g. `/tmp/tes=
t`,<br>
>> start typing<br>
>><br>
>> Here's part of the profiling result:<br>
>><br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 114=C2=A0 62% - redisplay_intern=
al (C function)<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A042=C2=A0 23%=C2=A0 - eval<=
br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0-=
project-mode-line-format<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 =
- project-current<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 =
=C2=A0- project--find-in-directory<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 =
=C2=A0 - run-hook-with-args-until-success<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0- project-try-vc<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A041=C2=A0 22%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 - project-try-vc--search<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A025=C2=A0 13%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0- project--value-in-dir<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 - hack-dir-local-variables<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0- #<byte-code-function 24E><br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 - hack-dir-local--get-variables<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- dir-locals-find-file<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A022=C2=A0 12%=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 - locate-dominating-file<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A012=C2=A0 =C2=A06%=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ abbreviate-file-name<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 3=C2=A0 =C2=A01%=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 + #<byte-code-function 98F><br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A013=C2=A0 =C2=A07%=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0- locate-dominating-file<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 6=C2=A0 =C2=A03%=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 + #<byte-code-function 4D9><br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 3=C2=A0 =C2=A01%=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 abbreviate-file-name<br>
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 3=C2=A0 =C2=A01%<br>
>><br>
>> It shows that `project-mode-line-format` can take a significant po=
rtion<br>
>> of the redisplay time. It increases even more when the directory i=
s deep<br>
>> or the disk is slow.<br>
>><br>
>> IMO the performance of this function should be improved.<br>
>><br>
>> I have two questions:<br>
>><br>
>> 1. Is it possible to simply cache the result as buffer-local?<br>
>> 2. IIUC some of the file reading comes from `project--value-in-dir=
`,<br>
>> which opens a temporary buffer to load dir local variables. Why do=
esn't<br>
>> it simply read the variable value in the current buffer?<br>
>><br>
><br>
>I've advised project functions to cache the "invariants" =
current project<br>
>and project root to incur these costs once per buffer.=C2=A0 I also cac=
he the<br>
>nuance of a "non project" to avoid repeated project probing o=
n buffers that<br>
>don't have a project.<br>
><br>
>I thought maybe I was the only person silly enough to invoke costly pro=
ject<br>
>functions for every tab in `tab-bar` and every mode-line update.<br>
><br>
>I could contribute optional caching to project.el if there is sufficien=
t<br>
>demand for it.=C2=A0 Unless someone else wants to.<br>
<br>
We could also just have the IO functions signal error if called during a mo=
de line update.</blockquote><div dir=3D"auto"><br></div><div dir=3D"auto">P=
ersonally I think this is a great idea. Aside from mode line updates, IO fu=
nctions can cause undesired delay in=C2=A0many other functions (like tab ba=
r or maybe post command hook). If we have a general way to mark certain hoo=
ks as =E2=80=9Cshould not block by IO=E2=80=9D and be able to capture those=
violations,=C2=A0it would be very helpful.=C2=A0</div><div dir=3D"auto"><b=
r></div><div dir=3D"auto"><br></div><div dir=3D"auto">Yikai</div><div dir=
=3D"auto"><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0=
px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex=
;border-left-color:rgb(204,204,204)" dir=3D"auto"><br>
</blockquote></div></div>
--0000000000007777600635bc7173--
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Daniel Colascione <dancol@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 22 May 2025 17:22:02 +0000
Resent-Message-ID: <handler.78545.B.174793449816044 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Yikai Zhao <yikai@HIDDEN>
Cc: 78545 <at> debbugs.gnu.org, shipmints@HIDDEN
X-Debbugs-Original-Cc: bug-gnu-emacs@HIDDEN, 78545 <at> debbugs.gnu.org, Ship Mints <shipmints@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.174793449816044
(code B ref -1); Thu, 22 May 2025 17:22:02 +0000
Received: (at submit) by debbugs.gnu.org; 22 May 2025 17:21:38 +0000
Received: from localhost ([127.0.0.1]:37038 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uI9bu-0004Af-Ch
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 13:21:38 -0400
Received: from lists.gnu.org ([2001:470:142::17]:37298)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <dancol@HIDDEN>) id 1uI9br-00049b-Ov
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 13:21:36 -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 <dancol@HIDDEN>) id 1uI9bl-0001w4-Pm
for bug-gnu-emacs@HIDDEN; Thu, 22 May 2025 13:21:29 -0400
Received: from dancol.org ([2600:3c01:e000:3d8::1])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <dancol@HIDDEN>) id 1uI9bi-0003fc-Hp
for bug-gnu-emacs@HIDDEN; Thu, 22 May 2025 13:21:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org;
s=x;
h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:
References:In-Reply-To:Subject:CC:To:From:Date:Sender:Reply-To:Content-ID:
Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
List-Post:List-Owner:List-Archive;
bh=OEW2nYaueL/DEkqhNY4HMRFwaZYEgK26hnvh/m8o74c=; b=k3UEaX/sGUdkbaMT/2BYUMxxBO
oTTMFvt5OxQJDHp+5tcZTDFi75pWa6y51M0C3aE71F0YkP3okFk3qzQD75UuoI1PAGHlcdZzFx7U6
QMVhRYXwviI15NsNb3K9ig7+oEUnLvzlQQCoC0ZzGY3k2//dc/rmDx7Jq4pmDLjX7dAXQ+g/hoHAr
iWe8hc1iwB4mlsiMyktq70XnFwqZogoIrcztUcgBNCywtlL6HQymlbQ4xylAQ+w6heXcbvjXCnVjx
kBXneEoY9h8PMvH+DX00g/VSTeaWjvOtB3VCkkIES2UKzItksfoC3VfMgwlgC8WgdAMT3V5Apire6
/aMdrIWA==;
Received: from [2600:1006:b19d:16b2:0:50:482a:bd01] (port=50326
helo=[IPv6:::1])
by dancol.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
(Exim 4.96) (envelope-from <dancol@HIDDEN>) id 1uI9ac-00AFZD-2r;
Thu, 22 May 2025 13:20:19 -0400
Date: Thu, 22 May 2025 13:21:18 -0400
From: Daniel Colascione <dancol@HIDDEN>
User-Agent: K-9 Mail for Android
In-Reply-To: <CANMyjpj534R+CxiRzk0ht9fv2aeraFn+4EuPmtboYtyRdNOFZQ@HIDDEN>
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CAN+1Hbr2z+5cfFz=B0rDyqbvpiVbFODuuDccUyCWP=mSYcWEsw@HIDDEN>
<14B95357-B1E5-4301-AFF9-B5658EDE532E@HIDDEN>
<CANMyjpj534R+CxiRzk0ht9fv2aeraFn+4EuPmtboYtyRdNOFZQ@HIDDEN>
Message-ID: <0943DFD3-DDCE-486F-831D-8AAA3E43BE6C@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=2600:3c01:e000:3d8::1;
envelope-from=dancol@HIDDEN; helo=dancol.org
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, SPF_HELO_PASS=-0.001,
SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)
On May 22, 2025 1:02:02 PM EDT, Yikai Zhao <yikai@z1k=2Edev> wrote:
>On Thu, May 22, 2025 at 23:54 Daniel Colascione <dancol@dancol=2Eorg> wro=
te:
>
>>
>>
>> On May 22, 2025 7:47:18 AM EDT, Ship Mints <shipmints@gmail=2Ecom> wrot=
e:
>> >On Thu, May 22, 2025 at 2:17=E2=80=AFAM Yikai Zhao <yikai@z1k=2Edev> w=
rote:
>> >
>> >> After enabling `project-mode-line`, I find my emacs slightly less
>> >> responsive=2E I think it's because project-mode-line is slow due to
>> >> it trying to read files on each update=2E Here's how I reproduce it:
>> >>
>> >> - Run `emacs -Q`
>> >> - Evaluate `(setopt project-mode-line t)`
>> >> - Open some random file in a non-project directory, e=2Eg=2E `/tmp/t=
est`,
>> >> start typing
>> >>
>> >> Here's part of the profiling result:
>> >>
>> >> 114 62% - redisplay_internal (C function)
>> >> 42 23% - eval
>> >> 41 22% - project-mode-line-format
>> >> 41 22% - project-current
>> >> 41 22% - project--find-in-directory
>> >> 41 22% - run-hook-with-args-until-success
>> >> 41 22% - project-try-vc
>> >> 41 22% - project-try-vc--search
>> >> 25 13% - project--value-in-dir
>> >> 22 12% - hack-dir-local-variables
>> >> 22 12% - #<byte-code-function 24E>
>> >> 22 12% - hack-dir-local--get-variables
>> >> 22 12% - dir-locals-find-file
>> >> 22 12% - locate-dominating-file
>> >> 12 6% + abbreviate-file-name
>> >> 3 1% + #<byte-code-function 98F>
>> >> 13 7% - locate-dominating-file
>> >> 6 3% + #<byte-code-function 4D9>
>> >> 3 1% abbreviate-file-name
>> >> 3 1%
>> >>
>> >> It shows that `project-mode-line-format` can take a significant port=
ion
>> >> of the redisplay time=2E It increases even more when the directory i=
s deep
>> >> or the disk is slow=2E
>> >>
>> >> IMO the performance of this function should be improved=2E
>> >>
>> >> I have two questions:
>> >>
>> >> 1=2E Is it possible to simply cache the result as buffer-local?
>> >> 2=2E IIUC some of the file reading comes from `project--value-in-dir=
`,
>> >> which opens a temporary buffer to load dir local variables=2E Why do=
esn't
>> >> it simply read the variable value in the current buffer?
>> >>
>> >
>> >I've advised project functions to cache the "invariants" current proje=
ct
>> >and project root to incur these costs once per buffer=2E I also cache=
the
>> >nuance of a "non project" to avoid repeated project probing on buffers
>> that
>> >don't have a project=2E
>> >
>> >I thought maybe I was the only person silly enough to invoke costly
>> project
>> >functions for every tab in `tab-bar` and every mode-line update=2E
>> >
>> >I could contribute optional caching to project=2Eel if there is suffic=
ient
>> >demand for it=2E Unless someone else wants to=2E
>>
>> We could also just have the IO functions signal error if called during =
a
>> mode line update=2E
>
>
>Personally I think this is a great idea=2E Aside from mode line updates, =
IO
>functions can cause undesired delay in many other functions (like tab bar
>or maybe post command hook)=2E If we have a general way to mark certain h=
ooks
>as =E2=80=9Cshould not block by IO=E2=80=9D and be able to capture those =
violations, it
>would be very helpful=2E
I've been meaning to write a slow hook detector for a few weeks now=2E Fee=
l free to beat me to it=2E I figure we can start by just calling each entry=
in the major hooks with a new run hooks (with args) variant that records t=
imes of each and reports anything over a threshold as a warning=2E
>
>
>Yikai
>
>
>>
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Daniel Colascione <dancol@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 22 May 2025 17:22:02 +0000
Resent-Message-ID: <handler.78545.B78545.174793449215995 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Yikai Zhao <yikai@HIDDEN>
Cc: 78545 <at> debbugs.gnu.org, shipmints@HIDDEN
X-Debbugs-Original-Cc: bug-gnu-emacs@HIDDEN, 78545 <at> debbugs.gnu.org, Ship Mints <shipmints@HIDDEN>
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.174793449215995
(code B ref 78545); Thu, 22 May 2025 17:22:02 +0000
Received: (at 78545) by debbugs.gnu.org; 22 May 2025 17:21:32 +0000
Received: from localhost ([127.0.0.1]:37035 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uI9bn-00049u-MU
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 13:21:32 -0400
Received: from dancol.org ([2600:3c01:e000:3d8::1]:57410)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <dancol@HIDDEN>) id 1uI9bk-00049I-79
for 78545 <at> debbugs.gnu.org; Thu, 22 May 2025 13:21:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org;
s=x;
h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:
References:In-Reply-To:Subject:CC:To:From:Date:Sender:Reply-To:Content-ID:
Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
List-Post:List-Owner:List-Archive;
bh=OEW2nYaueL/DEkqhNY4HMRFwaZYEgK26hnvh/m8o74c=; b=k3UEaX/sGUdkbaMT/2BYUMxxBO
oTTMFvt5OxQJDHp+5tcZTDFi75pWa6y51M0C3aE71F0YkP3okFk3qzQD75UuoI1PAGHlcdZzFx7U6
QMVhRYXwviI15NsNb3K9ig7+oEUnLvzlQQCoC0ZzGY3k2//dc/rmDx7Jq4pmDLjX7dAXQ+g/hoHAr
iWe8hc1iwB4mlsiMyktq70XnFwqZogoIrcztUcgBNCywtlL6HQymlbQ4xylAQ+w6heXcbvjXCnVjx
kBXneEoY9h8PMvH+DX00g/VSTeaWjvOtB3VCkkIES2UKzItksfoC3VfMgwlgC8WgdAMT3V5Apire6
/aMdrIWA==;
Received: from [2600:1006:b19d:16b2:0:50:482a:bd01] (port=50326
helo=[IPv6:::1])
by dancol.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
(Exim 4.96) (envelope-from <dancol@HIDDEN>) id 1uI9ac-00AFZD-2r;
Thu, 22 May 2025 13:20:19 -0400
Date: Thu, 22 May 2025 13:21:18 -0400
From: Daniel Colascione <dancol@HIDDEN>
User-Agent: K-9 Mail for Android
In-Reply-To: <CANMyjpj534R+CxiRzk0ht9fv2aeraFn+4EuPmtboYtyRdNOFZQ@HIDDEN>
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CAN+1Hbr2z+5cfFz=B0rDyqbvpiVbFODuuDccUyCWP=mSYcWEsw@HIDDEN>
<14B95357-B1E5-4301-AFF9-B5658EDE532E@HIDDEN>
<CANMyjpj534R+CxiRzk0ht9fv2aeraFn+4EuPmtboYtyRdNOFZQ@HIDDEN>
Message-ID: <0943DFD3-DDCE-486F-831D-8AAA3E43BE6C@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain;
charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On May 22, 2025 1:02:02 PM EDT, Yikai Zhao <yikai@z1k=2Edev> wrote:
>On Thu, May 22, 2025 at 23:54 Daniel Colascione <dancol@dancol=2Eorg> wro=
te:
>
>>
>>
>> On May 22, 2025 7:47:18 AM EDT, Ship Mints <shipmints@gmail=2Ecom> wrot=
e:
>> >On Thu, May 22, 2025 at 2:17=E2=80=AFAM Yikai Zhao <yikai@z1k=2Edev> w=
rote:
>> >
>> >> After enabling `project-mode-line`, I find my emacs slightly less
>> >> responsive=2E I think it's because project-mode-line is slow due to
>> >> it trying to read files on each update=2E Here's how I reproduce it:
>> >>
>> >> - Run `emacs -Q`
>> >> - Evaluate `(setopt project-mode-line t)`
>> >> - Open some random file in a non-project directory, e=2Eg=2E `/tmp/t=
est`,
>> >> start typing
>> >>
>> >> Here's part of the profiling result:
>> >>
>> >> 114 62% - redisplay_internal (C function)
>> >> 42 23% - eval
>> >> 41 22% - project-mode-line-format
>> >> 41 22% - project-current
>> >> 41 22% - project--find-in-directory
>> >> 41 22% - run-hook-with-args-until-success
>> >> 41 22% - project-try-vc
>> >> 41 22% - project-try-vc--search
>> >> 25 13% - project--value-in-dir
>> >> 22 12% - hack-dir-local-variables
>> >> 22 12% - #<byte-code-function 24E>
>> >> 22 12% - hack-dir-local--get-variables
>> >> 22 12% - dir-locals-find-file
>> >> 22 12% - locate-dominating-file
>> >> 12 6% + abbreviate-file-name
>> >> 3 1% + #<byte-code-function 98F>
>> >> 13 7% - locate-dominating-file
>> >> 6 3% + #<byte-code-function 4D9>
>> >> 3 1% abbreviate-file-name
>> >> 3 1%
>> >>
>> >> It shows that `project-mode-line-format` can take a significant port=
ion
>> >> of the redisplay time=2E It increases even more when the directory i=
s deep
>> >> or the disk is slow=2E
>> >>
>> >> IMO the performance of this function should be improved=2E
>> >>
>> >> I have two questions:
>> >>
>> >> 1=2E Is it possible to simply cache the result as buffer-local?
>> >> 2=2E IIUC some of the file reading comes from `project--value-in-dir=
`,
>> >> which opens a temporary buffer to load dir local variables=2E Why do=
esn't
>> >> it simply read the variable value in the current buffer?
>> >>
>> >
>> >I've advised project functions to cache the "invariants" current proje=
ct
>> >and project root to incur these costs once per buffer=2E I also cache=
the
>> >nuance of a "non project" to avoid repeated project probing on buffers
>> that
>> >don't have a project=2E
>> >
>> >I thought maybe I was the only person silly enough to invoke costly
>> project
>> >functions for every tab in `tab-bar` and every mode-line update=2E
>> >
>> >I could contribute optional caching to project=2Eel if there is suffic=
ient
>> >demand for it=2E Unless someone else wants to=2E
>>
>> We could also just have the IO functions signal error if called during =
a
>> mode line update=2E
>
>
>Personally I think this is a great idea=2E Aside from mode line updates, =
IO
>functions can cause undesired delay in many other functions (like tab bar
>or maybe post command hook)=2E If we have a general way to mark certain h=
ooks
>as =E2=80=9Cshould not block by IO=E2=80=9D and be able to capture those =
violations, it
>would be very helpful=2E
I've been meaning to write a slow hook detector for a few weeks now=2E Fee=
l free to beat me to it=2E I figure we can start by just calling each entry=
in the major hooks with a new run hooks (with args) variant that records t=
imes of each and reports anything over a threshold as a warning=2E
>
>
>Yikai
>
>
>>
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 22 May 2025 19:26:01 +0000
Resent-Message-ID: <handler.78545.B78545.174794192125529 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Yikai Zhao <yikai@HIDDEN>
Cc: dancol@HIDDEN, 78545 <at> debbugs.gnu.org, shipmints@HIDDEN
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.174794192125529
(code B ref 78545); Thu, 22 May 2025 19:26:01 +0000
Received: (at 78545) by debbugs.gnu.org; 22 May 2025 19:25:21 +0000
Received: from localhost ([127.0.0.1]:38353 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uIBXd-0006dg-EY
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 15:25:21 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:33024)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uIBXb-0006c7-4K
for 78545 <at> debbugs.gnu.org; Thu, 22 May 2025 15:25:19 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
id 1uIBXU-0001QK-AW; Thu, 22 May 2025 15:25:12 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
Date; bh=R+EfsYaUHJCP99TZh9L2sKmQjbjlrCBu61W/gsk0RGY=; b=Bc/GEgwFOwMQ6IumE3cT
k9YQkPET8qJtMTXdv+xtfSUg3xC/62Ozuof2Uv351atV7IuXwCGdDy7O1U50qq/Ft+33hvcfqkfZd
4i1S1YweyLSiuH7dSvl45l3QNfHhSLRRN+C+U9mqMQM8S956khIoE7tzHXNNR9lZtAybsdscl7gJA
qpRPy1XCfcSaFNvrQLMRjBEYOfAGLtjfbSVt1QiIVG+ipXG+UweD+BxJ4DcuKMpmvSMB+QoG5vDGX
TXo01SR6uOTZX6ZKVcT8mwxGBOBJF87gnEvgHmX426sAsGk8n6o5P+GAmuJoqUroovVBhikyZqcD2
iz4xPq1ES9KwyQ==;
Date: Thu, 22 May 2025 22:25:05 +0300
Message-Id: <86frgw5tym.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <CANMyjpj534R+CxiRzk0ht9fv2aeraFn+4EuPmtboYtyRdNOFZQ@HIDDEN>
(message from Yikai Zhao on Fri, 23 May 2025 01:02:02 +0800)
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CAN+1Hbr2z+5cfFz=B0rDyqbvpiVbFODuuDccUyCWP=mSYcWEsw@HIDDEN>
<14B95357-B1E5-4301-AFF9-B5658EDE532E@HIDDEN>
<CANMyjpj534R+CxiRzk0ht9fv2aeraFn+4EuPmtboYtyRdNOFZQ@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
> Cc: 78545 <at> debbugs.gnu.org, shipmints@HIDDEN
> From: Yikai Zhao <yikai@HIDDEN>
> Date: Fri, 23 May 2025 01:02:02 +0800
>
> We could also just have the IO functions signal error if called during a mode line update.
>
> Personally I think this is a great idea. Aside from mode line updates, IO functions can cause undesired delay
> in many other functions (like tab bar or maybe post command hook). If we have a general way to mark
> certain hooks as “should not block by IO” and be able to capture those violations, it would be very helpful.
Signaling an error inside redisplay is not useful. It just writes a
message into *Messages* and that's it. Unless you are very vigilant,
it will take you a long time to even look in *Messages* and realize
Emacs signaled that error.
If a function doesn't want to do its job in some situation, it should
return without doing anything, rather than signaling an error.
Besides, I see nothing wrong with calling from redisplay functions
that access the filesystem, not in general, anyway. Sure, calling
locate-dominating-file from a deep directory is not a very wise thing
to do as part of updating the mode line, but Emacs always gives us
enough rope to hang ourselves, trusting us that we won't. We should
live up to that trust by not doing silly things.
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 22 May 2025 19:29:02 +0000
Resent-Message-ID: <handler.78545.B78545.174794209926462 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Daniel Colascione <dancol@HIDDEN>
Cc: yikai@HIDDEN, 78545 <at> debbugs.gnu.org, shipmints@HIDDEN
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.174794209926462
(code B ref 78545); Thu, 22 May 2025 19:29:02 +0000
Received: (at 78545) by debbugs.gnu.org; 22 May 2025 19:28:19 +0000
Received: from localhost ([127.0.0.1]:38393 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uIBaV-0006sj-5M
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 15:28:19 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:55744)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uIBaR-0006s5-N9
for 78545 <at> debbugs.gnu.org; Thu, 22 May 2025 15:28:16 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
id 1uIBaL-00025S-Qb; Thu, 22 May 2025 15:28:09 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
mime-version; bh=CsZgpQHRvC0WtdWNqo5sERti4NzNyTwyRfei1oJjjtk=; b=r4JBvkohYajf
7eM/5UPHJqLoYVOKb4RAJaP0EUNhRZQRX0T28lTUoM98XMNr4SOfLzlAFGLTAsPFlD2N5LDbkGJAt
giMPN4ob4vlpC2Bj+OhwfVSzq0BSqwb+Qzukrg6z6Dqs5exjU/U9XqhECr+o5tK2TVXPLFCW2VnzR
dKNfUUoAT41MxfPwZa2NSiqo0GYGSfRmqKgvXLqZTZlQK8NEySuWoqb7Dkr2/lFc6lXeCQKTFC3Xn
TZD68nTJyKPND9PF9I0Zs0+PpsyeSkNKSTaDuXEiH50fQfYHFU3NUCTCNxUB5GBKaq9VTAJXenlUO
BC+A/6XNZZGQjS4YEJ8Sgw==;
Date: Thu, 22 May 2025 22:28:07 +0300
Message-Id: <86ecwg5ttk.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <0943DFD3-DDCE-486F-831D-8AAA3E43BE6C@HIDDEN> (message from
Daniel Colascione on Thu, 22 May 2025 13:21:18 -0400)
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CAN+1Hbr2z+5cfFz=B0rDyqbvpiVbFODuuDccUyCWP=mSYcWEsw@HIDDEN>
<14B95357-B1E5-4301-AFF9-B5658EDE532E@HIDDEN>
<CANMyjpj534R+CxiRzk0ht9fv2aeraFn+4EuPmtboYtyRdNOFZQ@HIDDEN>
<0943DFD3-DDCE-486F-831D-8AAA3E43BE6C@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
> Cc: 78545 <at> debbugs.gnu.org, shipmints@HIDDEN
> Date: Thu, 22 May 2025 13:21:18 -0400
> From: Daniel Colascione <dancol@HIDDEN>
>
> I've been meaning to write a slow hook detector for a few weeks now. Feel free to beat me to it. I figure we can start by just calling each entry in the major hooks with a new run hooks (with args) variant that records times of each and reports anything over a threshold as a warning.
I think that would be a very useful feature. But it won't find this
particular problem, because project.el doesn't use a hook to update
the mode line in this case.
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Dmitry Gutov <dmitry@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 23 May 2025 00:38:01 +0000
Resent-Message-ID: <handler.78545.B78545.174796066430785 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Daniel Colascione <dancol@HIDDEN>, 78545 <at> debbugs.gnu.org, shipmints@HIDDEN, yikai@HIDDEN
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.174796066430785
(code B ref 78545); Fri, 23 May 2025 00:38:01 +0000
Received: (at 78545) by debbugs.gnu.org; 23 May 2025 00:37:44 +0000
Received: from localhost ([127.0.0.1]:40980 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1uIGPr-00080H-NX
for submit <at> debbugs.gnu.org; Thu, 22 May 2025 20:37:43 -0400
Received: from fout-b2-smtp.messagingengine.com ([202.12.124.145]:36093)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <dmitry@HIDDEN>) id 1uIGPk-0007zT-MW
for 78545 <at> debbugs.gnu.org; Thu, 22 May 2025 20:37:37 -0400
Received: from phl-compute-05.internal (phl-compute-05.phl.internal
[10.202.2.45])
by mailfout.stl.internal (Postfix) with ESMTP id 496B0114013F;
Thu, 22 May 2025 20:37:26 -0400 (EDT)
Received: from phl-mailfrontend-02 ([10.202.2.163])
by phl-compute-05.internal (MEProxy); Thu, 22 May 2025 20:37:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=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:subject:subject:to:to; s=fm2; t=1747960646;
x=1748047046; bh=ckvYx8LB+QYM7njWOYSsBZwube7gbqhZ6RvbHeDG/r4=; b=
XtvYPWZbcZq7qGU5KDacMkG/sBxY/pQ0c5UL8dG93XReqzJybXhcfqg/zk8GHMrG
Ct1L7pwWn6HcqJwUrWjLaSqY6CwIxYc6nSLDoVrDOUgMDcEc2060/qGKiQe+USwx
xqY2Za43volBHzt/NIrlI9aHFRsz7r6pbM1D8gJbQe8x35Oo/G/P8aw+nt0j0dcR
m4bVRF10RgIoi3y5DxLcGN9f5qkzGwF4zgNs14qlU84t42TG3+0ImjE632pdHnc/
FjXInOQ4ZEBbXNYOI4bo66zTO+zT813vSi+C+US1vzLIH+xB61NT0Az5Gn0IyZ17
V1+cAHPaZlsNyVeqBqXMpw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=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:subject:subject:to:to:x-me-proxy:x-me-sender
:x-me-sender:x-sasl-enc; s=fm3; t=1747960646; x=1748047046; bh=c
kvYx8LB+QYM7njWOYSsBZwube7gbqhZ6RvbHeDG/r4=; b=VR0HWtRjT1VUCfOkw
cH6YrL5Kbukof1xmXUeRSExkC9xbPT3ori4Ogexg0/mpYAxFlItdEft90ms9g7P/
z5z2UNCUx86yoHJCrki2ezAkhNO/O0POoatX1OL7csNNrwUGDamJcU+noKBTOgy3
4uGdBBzDApbsLFpH2UyZj61Xh+UHlInqRpp4qD3I567hbnxBlaS0RAdSldIRbEYd
G65NDKLLrj8KKW4+KJ8BmwdMrqIN1uYIYreVvnBx6hGPXWn9vRbhhvzaSc4C5CK7
Y6BVFfMB2wgjB/ow4BSNWJO0jqP1E+ZQ0coC8T4zqHlFJulSexOURLGB8PpxHkB/
hsuDg==
X-ME-Sender: <xms:RcMvaGUQTkWIlhU9274iQofajQXHYqm7wRW3_miZsMH9QHN5HXiDXw>
<xme:RcMvaCnVCaB2KXyPDQHi4gvVO_pxf8QyTfm25iB8DVETzT7b_U4uQs1tDi6-ymDxz
72Uv0dcAxg8efXiiqc>
X-ME-Received: <xmr:RcMvaKbw3gDnlfL7S5lWdt0kFYeJ9h3jUsbRZdO8JCGNCrgdG4nHefSbHTcH87YEdh9T>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddtgdejgedvucdltddurdegfedvrddttd
dmucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgf
nhhsuhgsshgtrhhisggvpdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttd
enucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvfhfh
jggtgfesthejredttddvjeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmih
htrhihsehguhhtohhvrdguvghvqeenucggtffrrghtthgvrhhnpedthfeuvddtveelgeeu
leevvdejveehffevveehvdeuffdtfefhvdeugefgtefgtdenucevlhhushhtvghrufhiii
gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggv
vhdpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepug
grnhgtohhlsegurghntgholhdrohhrghdprhgtphhtthhopeejkeehgeehseguvggssghu
ghhsrdhgnhhurdhorhhgpdhrtghpthhtohepshhhihhpmhhinhhtshesghhmrghilhdrtg
homhdprhgtphhtthhopeihihhkrghiseiiudhkrdguvghv
X-ME-Proxy: <xmx:RcMvaNUGDb3Hx6NwtxuAjhRGD0ZJWTwlRBSC2Ham1O01T7u-0qWQGw>
<xmx:RcMvaAkLT3Etta46reZYm5R-RJMxbcTuMaDi2f2zB_sOPaKHk4emZg>
<xmx:RcMvaCdlxL3Px15PxfPX-0lhSn_MXKDDd5I2xrBPpnSAMhPzLfmxvg>
<xmx:RcMvaCGtEcR-wcTlXDUtcoZj6EGyU6tdAX5mIhtE1R5qvAsK2itcRw>
<xmx:RsMvaDmv5p5abFVclJIlCaUUuzCjgYz46QX2ARJ1s07zaJ5aOCdFuQqn>
Feedback-ID: i07de48aa:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu,
22 May 2025 20:37:24 -0400 (EDT)
Message-ID: <ca8da1e6-dd2b-4615-872e-b238859693c1@HIDDEN>
Date: Fri, 23 May 2025 03:37:21 +0300
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CAN+1Hbr2z+5cfFz=B0rDyqbvpiVbFODuuDccUyCWP=mSYcWEsw@HIDDEN>
<14B95357-B1E5-4301-AFF9-B5658EDE532E@HIDDEN>
Content-Language: en-US
From: Dmitry Gutov <dmitry@HIDDEN>
In-Reply-To: <14B95357-B1E5-4301-AFF9-B5658EDE532E@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
On 22/05/2025 18:53, Daniel Colascione wrote:
> We could also just have the IO functions signal error if called during a mode line update.
The first 'project-current' call might as well happen during the
mode-line refresh, when the project root is not cached. What's
problematic is having these calls do I/O every time.
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Kristoffer Balintona <krisbalintona@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 08 Dec 2025 00:44:02 +0000
Resent-Message-ID: <handler.78545.B78545.176515461716562 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Yikai Zhao <yikai@HIDDEN>, 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.176515461716562
(code B ref 78545); Mon, 08 Dec 2025 00:44:02 +0000
Received: (at 78545) by debbugs.gnu.org; 8 Dec 2025 00:43:37 +0000
Received: from localhost ([127.0.0.1]:42320 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vSPLk-0004J4-Uz
for submit <at> debbugs.gnu.org; Sun, 07 Dec 2025 19:43:37 -0500
Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]:59622)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <krisbalintona@HIDDEN>)
id 1vSPLi-0004Il-1X
for 78545 <at> debbugs.gnu.org; Sun, 07 Dec 2025 19:43:34 -0500
Received: by mail-lf1-x12b.google.com with SMTP id
2adb3069b0e04-5958931c9c7so4936135e87.2
for <78545 <at> debbugs.gnu.org>; Sun, 07 Dec 2025 16:43:33 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1765154607; x=1765759407; darn=debbugs.gnu.org;
h=to:subject:message-id:date:mime-version:references:in-reply-to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=tpjFi+Ghh3RJT0wtelFjAqM8RaFE7+z9gTSrYjd59Dw=;
b=bvqlyPDDMiZJ76jomlEbbeJDMvAXbk/6t/csS14Pj1GMO9GmiF+WgVSAiaxuws3e0v
UsXG6iXGHV/7cQYxpYOt6pYhTl8UQzITSHkl2K4Z4ZGgy/hNbqIlLpBHnhXnZ5dYPO6m
Ilt4zxzIxqdDpj6ye+r/AG3OwoDEtwfE/WLF/TGYZ/DJ+3ua81tXnuYZvWk51C/IovxG
1tBu11i8svGyu3YvPl5BIiviklZ7Gnh0hMVxbXQTqs0j5a4+b3pSN4ktsTkHcFuh9Naa
O5UyH8WDmeMWx7kQkPNftA0QEC9fZ/SNWgKdl5zbsQssGprfm82Klnd1neliUBTvc8YO
5t8A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1765154607; x=1765759407;
h=to:subject:message-id:date:mime-version:references:in-reply-to:from
:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=tpjFi+Ghh3RJT0wtelFjAqM8RaFE7+z9gTSrYjd59Dw=;
b=UJuHWVqtVAb4SOYA9FlH8ZvylFy5msiJ1xmlTpfEylb21RW0X/L73+HLUcl723htya
CX4i3dbzKQ7WjTubj7vkma8VK+DyTuEUapCDWjZUz5wENF1qZyY73t8NrK2+DKwYFgW4
zNbyfjMAbnQuo5XCj1WyIQ/QmQhfUEsSt/4I4sABXX0UTm2J/MhaPwgmykudfzKWZBUl
5CtauUpZD+JgbISBRAqEHZ7UwzWvMnaF7aA9WphtNEeai5MPx6wv4NNd6IYAcGVw92my
pu7Efzd5frbKgYcfNNvMa0g2cS/2JTO/FqnDmhfN2z+KZa6o7NjoY236PtexwCkM3snl
GAnw==
X-Forwarded-Encrypted: i=1;
AJvYcCUBMVrl1mVIlyHaSpTk7KwpZ6rSm4fgc5kFpQ9p87liYxVclIYqQ3bduSOYRzcmXVfLLgISsQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzchV2Jk4D0vxeDkm4W8mGDvAkht9jsiiEJRNVApEPm+z1ITzIA
Eiyom74Jj8DoJLrYAkDPOHAhUyybp5NdOvfS9HiKULjz2Vn5dEHhC0zMgj7Eicf5JtvX92D20oY
D1bJPkOoz3kFoN5/sphkdaH5ivn9159s=
X-Gm-Gg: ASbGnctXFD03GXoxfylvyODOBKxBbWjFRch56kqjaDdqJHqgO6gg21s8xRkY6XwyWgh
o6Ph2HmPGpRDdEef+0oxh8g26T+wJAVG4ibbjIx3BR7f/jEss/oixF5VavzM9+Ie9XhrAH1+fFA
AQjfOZ3JmQYuyu0S1brXi6VVPBKZM2v21UyAmnubwEK4OYO31V0aBSD2eQUVqZXS3fWx/z94l/x
R0BUCLRhdc37Su8NBZXP6AfMaWEpv4bxSV7wj1QwiYwFxnLyB5gbk4jfGx3J/td/sd/mHA=
X-Google-Smtp-Source: AGHT+IH0gRqsvJauE4vJW9bqOFT6tR8F5aq5H2rEM++9rgvtQFrXHzb6awBAOJuAJD/TPb3F5+n7KaZ9ynMG9aoUAu8=
X-Received: by 2002:a05:6512:b8e:b0:594:2eee:dd5 with SMTP id
2adb3069b0e04-598853bc58fmr2024279e87.24.1765154606884; Sun, 07 Dec 2025
16:43:26 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
HTTPREST; Sun, 7 Dec 2025 16:43:26 -0800
Received: from 753933720722 named unknown by gmailapi.google.com with
HTTPREST; Sun, 7 Dec 2025 16:43:26 -0800
From: Kristoffer Balintona <krisbalintona@HIDDEN>
In-Reply-To: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
MIME-Version: 1.0
Date: Sun, 7 Dec 2025 16:43:26 -0800
X-Gm-Features: AQt7F2q0Cj17KjUNB9uPPYL25tQhaCoMCinQq68lqsTd7PXTUAQnf8cdijPAOPo
Message-ID: <CANVbq5kzEuU2m0AmfDhOouHHHdtT5aZ=rCcH_oiLO8mLZwZaXg@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On Thu, May 22 2025, Yikai Zhao wrote:
> After enabling `project-mode-line`, I find my emacs slightly less
> responsive. I think it's because project-mode-line is slow due to
> it trying to read files on each update. Here's how I reproduce it:
>
> - Run `emacs -Q`
> - Evaluate `(setopt project-mode-line t)`
> - Open some random file in a non-project directory, e.g. `/tmp/test`,
> start typing
>
> [... 23 lines elided]
>
> It shows that `project-mode-line-format` can take a significant portion
> of the redisplay time. It increases even more when the directory is deep
> or the disk is slow.
>
> IMO the performance of this function should be improved.
>
> I have two questions:
>
> 1. Is it possible to simply cache the result as buffer-local?
> 2. IIUC some of the file reading comes from `project--value-in-dir`,
> which opens a temporary buffer to load dir local variables. Why doesn't
> it simply read the variable value in the current buffer?
I recently returned to this because I had the idea of using timeout.el's
`timeout-throttle' to help out with this:
(setopt project-mode-line-format '(:eval (timeout-throttle
'project-mode-line-format 0.2)))
My first impression of it is positive, but maybe I just haven't noticed
a shortcoming with this approach yet. I'm happy with it as a
customization in my config, but could adding a "throttle limit"[1] be a
legitimate upstream solution?
Footnotes:
[1] `timeout-throttle' also accepts a function to dynamically determine
the duration.
--
Kind regards,
Kristoffer
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Juri Linkov <juri@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 08 Dec 2025 18:04:01 +0000
Resent-Message-ID: <handler.78545.B78545.17652170202188 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Kristoffer Balintona <krisbalintona@HIDDEN>
Cc: Yikai Zhao <yikai@HIDDEN>, 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.17652170202188
(code B ref 78545); Mon, 08 Dec 2025 18:04:01 +0000
Received: (at 78545) by debbugs.gnu.org; 8 Dec 2025 18:03:40 +0000
Received: from localhost ([127.0.0.1]:47813 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vSfaG-0000ZD-4x
for submit <at> debbugs.gnu.org; Mon, 08 Dec 2025 13:03:40 -0500
Received: from mout-p-201.mailbox.org ([2001:67c:2050:0:465::201]:43654)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1vSfaD-0000Ys-Vc
for 78545 <at> debbugs.gnu.org; Mon, 08 Dec 2025 13:03:38 -0500
Received: from smtp102.mailbox.org (smtp102.mailbox.org
[IPv6:2001:67c:2050:b231:465::102])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4dQ8ww1Trwz9tH5;
Mon, 8 Dec 2025 19:03:28 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1765217008;
h=from:from: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;
bh=f8eJkIDTS/60z6za/0QdEbp9wMzim5nbPwJh3yfYQNU=;
b=N83/4WXmbKi9b8ZfBSXDYHR8TQKebcSzMZM78mM5fmg/9mNd3moA589+lllqUjT8mGXLDa
YYGB3CwTumYycSFYuiE0/aOxEpugciY5RTW8puEwUQWmwU6AQk0QgCdb19GU4JZiPY3dU0
8XTr5AP3rlJqaY6mlbDpNq3gYJ489X25bbGGxOt/ZxHjgZxyAzmbHVgnd6DdkI0+JaB5A6
SEyydZiF0P9tl3HpvWZPyY95YjHYU0dcxxp051o2kuVB2aXyz8eGwv01JigcTzbrFBpLko
WIu7iQEh49nox5Ess2h+Nq/3So9j1wzces1IuXV3D/dFpfJVTmiLTRod3nEvBA==
Authentication-Results: outgoing_mbo_mout; dkim=none;
spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates
2001:67c:2050:b231:465::102 as permitted sender)
smtp.mailfrom=juri@HIDDEN
From: Juri Linkov <juri@HIDDEN>
In-Reply-To: <CANVbq5kzEuU2m0AmfDhOouHHHdtT5aZ=rCcH_oiLO8mLZwZaXg@HIDDEN>
Organization: LINKOV.NET
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CANVbq5kzEuU2m0AmfDhOouHHHdtT5aZ=rCcH_oiLO8mLZwZaXg@HIDDEN>
Date: Mon, 08 Dec 2025 20:02:50 +0200
Message-ID: <87sedk7sxh.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Queue-Id: 4dQ8ww1Trwz9tH5
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
> I recently returned to this because I had the idea of using timeout.el's
> `timeout-throttle' to help out with this:
>
> (setopt project-mode-line-format '(:eval (timeout-throttle
> 'project-mode-line-format 0.2)))
No need to change 'project-mode-line-format'. It should be sufficient
just to call (timeout-throttle 'project-mode-line-format 0.2) once.
> My first impression of it is positive, but maybe I just haven't noticed
> a shortcoming with this approach yet. I'm happy with it as a
> customization in my config, but could adding a "throttle limit"[1] be a
> legitimate upstream solution?
While the idea looks good, unfortunately it can't be used as is.
For example, try to switch between buffers from different projects:
their project name is not updated.
However, a timer could be used to update a new buffer-local variable
that caches the result of 'project-mode-line-format'.
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Kristoffer Balintona <krisbalintona@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 08 Dec 2025 18:24:02 +0000
Resent-Message-ID: <handler.78545.B78545.17652182206433 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Juri Linkov <juri@HIDDEN>
Cc: Yikai Zhao <yikai@HIDDEN>, 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.17652182206433
(code B ref 78545); Mon, 08 Dec 2025 18:24:02 +0000
Received: (at 78545) by debbugs.gnu.org; 8 Dec 2025 18:23:40 +0000
Received: from localhost ([127.0.0.1]:47930 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vSftc-0001fg-FB
for submit <at> debbugs.gnu.org; Mon, 08 Dec 2025 13:23:40 -0500
Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]:47511)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <krisbalintona@HIDDEN>)
id 1vSftZ-0001fL-Sj
for 78545 <at> debbugs.gnu.org; Mon, 08 Dec 2025 13:23:38 -0500
Received: by mail-lf1-x12a.google.com with SMTP id
2adb3069b0e04-594270ec7f9so5246920e87.3
for <78545 <at> debbugs.gnu.org>; Mon, 08 Dec 2025 10:23:37 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1765218211; x=1765823011; darn=debbugs.gnu.org;
h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
:from:from:to:cc:subject:date:message-id:reply-to;
bh=LXb6wSvl6+p2Oy57MpMiv5IcjAEg5UszTn+UpZT1jjc=;
b=lt6wc6g/C9x9jgc6kO8PdK2rlocfabmW4ep7mbgzm+3/tJhPASKR2hGQL/gKd+wLup
+V3mgiZzH1vtskarIPMH4OvLiGkDq29U4Tfve6zLc39xCEfnoJM5Ap7gJx9Rx3qzOcIl
ocDff8MkeITmnodXVYHPu8whg4HlvB0n9++JYRybiiL5hssdFGd8iBiGa6bWMKkRbiNH
9vhBZbjGhcBJ5ipgHoSivLwn/oWUq9OpVxZqXtlCxqyfdjDwIohwPix2epAizS7lQOek
9j0OgjSkUBF+J7sZGP0T9kFC//JaNEnd/ZJsDSps32sFDkwUM2Hsora1WScRjMHJeMhP
TRig==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1765218211; x=1765823011;
h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=LXb6wSvl6+p2Oy57MpMiv5IcjAEg5UszTn+UpZT1jjc=;
b=XG9iyPCXASDbtG7+9tG7glQkwmbhSEjtuCEO0eJeR7bGY8bx7fFywNvsWTGcYTBiRp
nEEzzATZbg428Laj7mUPIIHrT0tkJ5N1rEXdK7HVolU1ua5nMhE8bm6AWSvIvBaezv6J
hQDl+lHWOpzDZSzLYFKtKvjKFa5HjtAGTMzD79DFqFrewTaNF3FcU2kcQqw2wf5Kw+cP
D2CIAcZABMswOSSKVsCKFjugtDPt3b3qBKeH4SvDlrJw3duPYTkFy2BHDYB6MGT2SkdW
q2prZO9cCAcDqcZP2XdNJ3/SJsM/N8katC+IlDT/o/QmHSQP8Vtgh1mGOxCQFoepWPnk
z3oQ==
X-Forwarded-Encrypted: i=1;
AJvYcCXZk4V1bBHcQYFJN3iBiQ5U9e0Z+wQ+sNxG6Zowfi8/ct7LUAHEXWGOMGD5idiVQhsg1QRaBA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yyx4XwO7ABAN5dlFDR8peUgZa8I6JKmTYvd3kR3OgEosiyd8zzL
XpVGwceVTGYqh9D8IFr0GKhEa0uHw15CY/cYUT5HqlwNdy0M62uVwJJCCkM4Tmu3tndKwA0fk3P
KFqkuw5PTcoB852RcrAcF8G8Q24CvSas=
X-Gm-Gg: ASbGncvJbjtEfgOZAsqgdR/FhNwYeslCNuM5QNDciiiZxpllxALidDtk2clEUtbQ0Q8
oxhMf8mmGcHyfyLjlUZYwL4NNzbpOkBO1OKqTDFqW78nS4YO52bWGr2AlE2H8os+AEek/XIM6z1
Re/nUG94XKmTZcfVP/TMfmhhXkRvtqiekqmj0kWU9lMv/bYEGHXvFvXpIJt2htpB4+4Y+6m+6AZ
A6QHbTyaUeuiXPm1J3D7WzTJz63uzmj3sAP0dvWumkXZuRn0jzphZwm/Y0HesGjE5ToAcw=
X-Google-Smtp-Source: AGHT+IFI7QV/TlEMXja0y7LmbGypd49jeGWVScmw6N91jmsIe04XabiUObxm6Vn+DDIo++/XZ5zXl9110WnaVJAWkUQ=
X-Received: by 2002:a05:6512:39d2:b0:594:49ed:3cf1 with SMTP id
2adb3069b0e04-59874373fa1mr3072553e87.10.1765218210195; Mon, 08 Dec 2025
10:23:30 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
HTTPREST; Mon, 8 Dec 2025 13:23:29 -0500
Received: from 753933720722 named unknown by gmailapi.google.com with
HTTPREST; Mon, 8 Dec 2025 13:23:29 -0500
From: Kristoffer Balintona <krisbalintona@HIDDEN>
In-Reply-To: <87sedk7sxh.fsf@HIDDEN>
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CANVbq5kzEuU2m0AmfDhOouHHHdtT5aZ=rCcH_oiLO8mLZwZaXg@HIDDEN>
<87sedk7sxh.fsf@HIDDEN>
MIME-Version: 1.0
Date: Mon, 8 Dec 2025 13:23:29 -0500
X-Gm-Features: AQt7F2pe5IME52LkjcR8elmq8n0qGRho5o2lqKi6s1USYT4_Ftv3ZtRFNv5gE2U
Message-ID: <CANVbq5kM=4=YOVmvr6pOCK=rBOevYcxg6bAcefqyQwS6MqHdtQ@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On Mon, Dec 08 2025, Juri Linkov wrote:
>> I recently returned to this because I had the idea of using timeout.el's
>> `timeout-throttle' to help out with this:
>>
>> (setopt project-mode-line-format '(:eval (timeout-throttle
>> 'project-mode-line-format 0.2)))
>
> No need to change 'project-mode-line-format'. It should be sufficient
> just to call (timeout-throttle 'project-mode-line-format 0.2) once.
Ah, thanks for the correction. I think I could've also used
`timeout-throttled-func'.
>> My first impression of it is positive, but maybe I just haven't noticed
>> a shortcoming with this approach yet. I'm happy with it as a
>> customization in my config, but could adding a "throttle limit"[1] be a
>> legitimate upstream solution?
>
> While the idea looks good, unfortunately it can't be used as is.
> For example, try to switch between buffers from different projects:
> their project name is not updated.
>
> However, a timer could be used to update a new buffer-local variable
> that caches the result of 'project-mode-line-format'.
Yes, that sounds both sufficient and uncomplicated.
--
Kind regards,
Kristoffer
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Juri Linkov <juri@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 09 Dec 2025 07:40:02 +0000
Resent-Message-ID: <handler.78545.B78545.176526594621844 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Kristoffer Balintona <krisbalintona@HIDDEN>
Cc: Yikai Zhao <yikai@HIDDEN>, 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.176526594621844
(code B ref 78545); Tue, 09 Dec 2025 07:40:02 +0000
Received: (at 78545) by debbugs.gnu.org; 9 Dec 2025 07:39:06 +0000
Received: from localhost ([127.0.0.1]:51549 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vSsJN-0005gB-DX
for submit <at> debbugs.gnu.org; Tue, 09 Dec 2025 02:39:06 -0500
Received: from mout-p-102.mailbox.org ([2001:67c:2050:0:465::102]:54520)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1vSsJL-0005fR-0R
for 78545 <at> debbugs.gnu.org; Tue, 09 Dec 2025 02:39:03 -0500
Received: from smtp1.mailbox.org (smtp1.mailbox.org
[IPv6:2001:67c:2050:b231:465::1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4dQW1m3LgMz9t32;
Tue, 9 Dec 2025 08:38:52 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1765265932;
h=from:from: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;
bh=IQzzm+ZYtMpOokpNTywJHd+yUoxkAnOBxAIDflmVKzI=;
b=hdu6h4At/N6fZs9b8dLvOIY6D7FNklWhc1ebXiBWLPeB9EQvowW6yJbP2VhlGWvpkcRcyJ
emOxpJAFyMRJ4F+0rAGXFnFB1MWP49OlVxT/STcOT6U5t0kax3XxaqybtCsl99bZ0LH2jK
gk3qRuxxeD1VcpV2lEI4oI9jekiwWhD/HiOfXfgA7itN451ofA1voXw6P4SEfiQ3ClxD9q
n96TawLE/7xcTH3D/Ms5ij31JBMHB3N3xdM4rzUqOUECa66Ps6ENmsZ9uWl8L+OCAPPS+w
SGEw/6uOf6OFV7M1BOWQ1pWGWOjzL1OhJ3INF5MBSGrxoM06cS4z4sOota3wdQ==
Authentication-Results: outgoing_mbo_mout; dkim=none;
spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates
2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=juri@HIDDEN
From: Juri Linkov <juri@HIDDEN>
In-Reply-To: <CANVbq5kM=4=YOVmvr6pOCK=rBOevYcxg6bAcefqyQwS6MqHdtQ@HIDDEN>
Organization: LINKOV.NET
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CANVbq5kzEuU2m0AmfDhOouHHHdtT5aZ=rCcH_oiLO8mLZwZaXg@HIDDEN>
<87sedk7sxh.fsf@HIDDEN>
<CANVbq5kM=4=YOVmvr6pOCK=rBOevYcxg6bAcefqyQwS6MqHdtQ@HIDDEN>
Date: Tue, 09 Dec 2025 09:25:12 +0200
Message-ID: <87fr9kw2f7.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Queue-Id: 4dQW1m3LgMz9t32
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
>>> I recently returned to this because I had the idea of using timeout.el's
>>> `timeout-throttle' to help out with this:
>>>
>>> (setopt project-mode-line-format '(:eval (timeout-throttle
>>> 'project-mode-line-format 0.2)))
>>
>> No need to change 'project-mode-line-format'. It should be sufficient
>> just to call (timeout-throttle 'project-mode-line-format 0.2) once.
>
> Ah, thanks for the correction. I think I could've also used
> `timeout-throttled-func'.
I tried to use `timeout-throttled-func', but it always returns a new function.
>>> My first impression of it is positive, but maybe I just haven't noticed
>>> a shortcoming with this approach yet. I'm happy with it as a
>>> customization in my config, but could adding a "throttle limit"[1] be a
>>> legitimate upstream solution?
>>
>> While the idea looks good, unfortunately it can't be used as is.
>> For example, try to switch between buffers from different projects:
>> their project name is not updated.
>>
>> However, a timer could be used to update a new buffer-local variable
>> that caches the result of 'project-mode-line-format'.
>
> Yes, that sounds both sufficient and uncomplicated.
Does this mean that we need a new function with a name like
`timeout-throttle-buffer-local' that instead of using
the lexically-bound `result' in `timeout--throttle-advice'
would update a buffer-local variable? Then maybe the timer
should be also buffer-local?
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Kristoffer Balintona <krisbalintona@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 09 Dec 2025 09:28:01 +0000
Resent-Message-ID: <handler.78545.B78545.176527246413477 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Juri Linkov <juri@HIDDEN>
Cc: Yikai Zhao <yikai@HIDDEN>, 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.176527246413477
(code B ref 78545); Tue, 09 Dec 2025 09:28:01 +0000
Received: (at 78545) by debbugs.gnu.org; 9 Dec 2025 09:27:44 +0000
Received: from localhost ([127.0.0.1]:52148 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vSu0V-0003VJ-T0
for submit <at> debbugs.gnu.org; Tue, 09 Dec 2025 04:27:44 -0500
Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]:59597)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <krisbalintona@HIDDEN>)
id 1vSu0U-0003Ur-B9
for 78545 <at> debbugs.gnu.org; Tue, 09 Dec 2025 04:27:43 -0500
Received: by mail-lf1-x134.google.com with SMTP id
2adb3069b0e04-5958931c9c7so6675895e87.2
for <78545 <at> debbugs.gnu.org>; Tue, 09 Dec 2025 01:27:42 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1765272456; x=1765877256; darn=debbugs.gnu.org;
h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
:from:from:to:cc:subject:date:message-id:reply-to;
bh=NanMlXzIUrr7arulKsMEiLWjyULZ/86Jh5WaxMrEhvk=;
b=ICRSMhQbfEttdrHGVucBTdURYHaqtBzxQ1gvMnN3gySlXL2wKe5mGIuEck0pen6TZ5
tGcP7QuRpbIBTQpwvr67m+4GX9Ap8dywUKECfoBzfAuYBdHQEwWT3sEdfMSjhRiuB0v7
3XfL7hem/BI11QtW0zV/3ikzK+5CPf910Z5vwU+k+7xbbjk5CyYy7yfLPZxLC3B7bH9H
H/Ku+cmlEsVWtboKeU64TfIpCOTb9G6tDGX3XSahBKc2HPeJ4dNDZK1lhnFDuHY08lKx
UjDzDUPFbkjaWu253Id9WNpGt8KEuL7tVk7Hao+1fJEd9WVDlzK+4nsqA8Q0A222MYXA
LIyg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1765272456; x=1765877256;
h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=NanMlXzIUrr7arulKsMEiLWjyULZ/86Jh5WaxMrEhvk=;
b=laJ6TGcLTi1zeZzOA0IMbf8M9E328VI45LjAdvQE1tNEPMYtskTAZnf6VbVAp0q+kt
a9WqsuKgVgPrWm6vi0vsfssZ1086FrpLED+ihNKueUfrQpz74RxkiqLB2Xlp3gMO94yv
Cxsa+QIo0dxqdjG7zkPo6o4oW2QPoA+up5qCH1blWAPHxl5ruIds52QB6cThVJiVlWJb
bbNktIqHezWF6kkfJWK5J4fTX0duPy7HHMx2c2xkHrZl1aVHU+NlO80zq5veuWemHAln
U6a2TgkJU6ckRhamapEoSGFk/3i9hdHpScqus0ovC+50D9nkQDWVDBkGt/qATDBv6u0s
iKKw==
X-Forwarded-Encrypted: i=1;
AJvYcCWcjj2BYR6OfHoTu8LplRdneIqG/hHQ82MTCcbV5Iy1OpctCerI7m9VnMN9GMaXH9H8spD37A==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwtrlEchaxmEHLBNq9Dm59durvEejiWHnsfFYNBMNJbpGFIPZ0O
uV8t5FPmHsJXoadUY/RpArNCMd0cVaby0K8TXSbq+PC8HXMyDQFaySSZIk+rNApG6UHux158ZIv
9gS73YkfJmG4IQt/iQmEdQnYqGXDtlv8=
X-Gm-Gg: ASbGncuLpthH6rbkBU8rMydQNymB8tpvcfr3OBrQzG3nk5DqS1V+Hi3w3wyXD5St/Um
oXLDz+7nHcm05NJM/BYvxjqIlV0KwRghQlCspqvR+vvMqms3oJJ1ufc1YzOnKk3sPrNJeZxebPL
/DOHOFyocgglrRbh76znISy6BHGlf+8D9ISuu4+AT1hvWMvjizD8D/oL8gxnv2P3uS0aNNb/LYG
dIT7HBp5Yf6ADOIjNlqeS7fX6OYLVY3R8ofIR8n8ibiL1Don/cZOcUxl7OQJ/0/uRtpjr3+ro1j
ZF4lUQ==
X-Google-Smtp-Source: AGHT+IHSWvFWe3cr/Yxuj5JwovgjEsN4VGedj81Kh+4jgo3I7hkwOwU7Cotpm7wc1a9fAGnW/ufix98nVtccmWXVh18=
X-Received: by 2002:a05:6512:682:b0:595:91dc:727e with SMTP id
2adb3069b0e04-5987e8cb92cmr3599120e87.22.1765272455510; Tue, 09 Dec 2025
01:27:35 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
HTTPREST; Tue, 9 Dec 2025 04:27:35 -0500
Received: from 753933720722 named unknown by gmailapi.google.com with
HTTPREST; Tue, 9 Dec 2025 04:27:35 -0500
From: Kristoffer Balintona <krisbalintona@HIDDEN>
In-Reply-To: <87fr9kw2f7.fsf@HIDDEN>
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CANVbq5kzEuU2m0AmfDhOouHHHdtT5aZ=rCcH_oiLO8mLZwZaXg@HIDDEN>
<87sedk7sxh.fsf@HIDDEN>
<CANVbq5kM=4=YOVmvr6pOCK=rBOevYcxg6bAcefqyQwS6MqHdtQ@HIDDEN>
<87fr9kw2f7.fsf@HIDDEN>
MIME-Version: 1.0
Date: Tue, 9 Dec 2025 04:27:35 -0500
X-Gm-Features: AQt7F2pmz0IeDJNJN2zak3ENPcnmrh9-CcXKRHa09JDgKyY92sEElL9BoWJQN2g
Message-ID: <CANVbq5nFGLACwGFCM=DK=dDj=Wsyp+DiqXJ4LtuotB-H_CT-tA@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On Tue, Dec 09 2025, Juri Linkov wrote:
>>>> I recently returned to this because I had the idea of using timeout.el's
>>>> `timeout-throttle' to help out with this:
>>>>
>>>> (setopt project-mode-line-format '(:eval (timeout-throttle
>>>> 'project-mode-line-format 0.2)))
>>>
>>> No need to change 'project-mode-line-format'. It should be sufficient
>>> just to call (timeout-throttle 'project-mode-line-format 0.2) once.
>>
>> Ah, thanks for the correction. I think I could've also used
>> `timeout-throttled-func'.
>
> I tried to use `timeout-throttled-func', but it always returns a new function.
What I had in mind was storing the function returned by
`timeout-throttled-func' in a variable and calling that function in
`project-mode-line-format'. AFAIU, `timeout-throttled-func' returns a
new function every time (as you said), so if you want to make repeat
calls to a function (while making use of timeout.el's throttling), you'd
have to store it somewhere.
I was just making an off-hand comment, though.
>>>> My first impression of it is positive, but maybe I just haven't noticed
>>>> a shortcoming with this approach yet. I'm happy with it as a
>>>> customization in my config, but could adding a "throttle limit"[1] be a
>>>> legitimate upstream solution?
>>>
>>> While the idea looks good, unfortunately it can't be used as is.
>>> For example, try to switch between buffers from different projects:
>>> their project name is not updated.
>>>
>>> However, a timer could be used to update a new buffer-local variable
>>> that caches the result of 'project-mode-line-format'.
>>
>> Yes, that sounds both sufficient and uncomplicated.
>
> Does this mean that we need a new function with a name like
> `timeout-throttle-buffer-local' that instead of using
> the lexically-bound `result' in `timeout--throttle-advice'
> would update a buffer-local variable? Then maybe the timer
> should be also buffer-local?
Hm, if I've understood the situation correctly, we don't need to have a
buffer-local variant of `timeout-throttle'. An equivalent approach would
be putting `project-mode-line-format' on a buffer-local timer (whose
result is cached in a buffer-local variable, with the value of that
variable being shown in the mode line).
But you mentioned earlier the case that just a throttled function is
insufficient since it wouldn't update the project mode line when e.g.
switching between buffers in different projects. So I think in addition
to a buffer-local timer calling `project-mode-line-format' to update our
variable, we'd also call `project-mode-line-format' after select
actions, like changing buffer or project.
Have I misunderstood?
--
Kind regards,
Kristoffer
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Juri Linkov <juri@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 09 Dec 2025 17:10:02 +0000
Resent-Message-ID: <handler.78545.B78545.176530017829518 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Kristoffer Balintona <krisbalintona@HIDDEN>
Cc: Yikai Zhao <yikai@HIDDEN>, 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.176530017829518
(code B ref 78545); Tue, 09 Dec 2025 17:10:02 +0000
Received: (at 78545) by debbugs.gnu.org; 9 Dec 2025 17:09:38 +0000
Received: from localhost ([127.0.0.1]:55364 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vT1DW-0007g2-1T
for submit <at> debbugs.gnu.org; Tue, 09 Dec 2025 12:09:38 -0500
Received: from mout-p-101.mailbox.org ([80.241.56.151]:45358)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1vT1DT-0007fX-0s
for 78545 <at> debbugs.gnu.org; Tue, 09 Dec 2025 12:09:35 -0500
Received: from smtp2.mailbox.org (smtp2.mailbox.org
[IPv6:2001:67c:2050:b231:465::2])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4dQlh63q6Qz9stL;
Tue, 9 Dec 2025 18:09:26 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1765300166;
h=from:from: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;
bh=CpXbHrni7VqwjgolYIn/IxEQzkVyFJ66kMHl4Oc2biU=;
b=tIKslWBhIdq6lC4lrsN6Qxa6O9APREKIJw18xGL+y9SDWQZjxSQsIzYhcpDQwSzHLLAeYb
kF0ISgEpfz3+okOTn8DKbBaAhnbEYd7FyUDc5HhDHajgQwWVYE7A/pGEPoxkgj9cwzFsgM
b+j2e3d/2/X2VwfbIJAORRn99dwfueq+H9kZsHFkECl0KAH/s1qs0vjhWsjIPYKFLrP3E0
ava9acNa3cJA9ysNNgTuZ0e24JfMlpq04jxb/L3j1q+yLlcAhVVwz9uCx8uWcKrHU+MX+C
P1QLzN+/M1Jp7qcMmW4I6oMhf+1xRH3btWw40RFccwxdM4rZMxZEyB4tYLB87Q==
Authentication-Results: outgoing_mbo_mout; dkim=none;
spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates
2001:67c:2050:b231:465::2 as permitted sender) smtp.mailfrom=juri@HIDDEN
From: Juri Linkov <juri@HIDDEN>
In-Reply-To: <CANVbq5nFGLACwGFCM=DK=dDj=Wsyp+DiqXJ4LtuotB-H_CT-tA@HIDDEN>
Organization: LINKOV.NET
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CANVbq5kzEuU2m0AmfDhOouHHHdtT5aZ=rCcH_oiLO8mLZwZaXg@HIDDEN>
<87sedk7sxh.fsf@HIDDEN>
<CANVbq5kM=4=YOVmvr6pOCK=rBOevYcxg6bAcefqyQwS6MqHdtQ@HIDDEN>
<87fr9kw2f7.fsf@HIDDEN>
<CANVbq5nFGLACwGFCM=DK=dDj=Wsyp+DiqXJ4LtuotB-H_CT-tA@HIDDEN>
Date: Tue, 09 Dec 2025 19:09:06 +0200
Message-ID: <87h5tz4n0l.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Queue-Id: 4dQlh63q6Qz9stL
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
>> I tried to use `timeout-throttled-func', but it always returns a new function.
>
> What I had in mind was storing the function returned by
> `timeout-throttled-func' in a variable and calling that function in
> `project-mode-line-format'. AFAIU, `timeout-throttled-func' returns a
> new function every time (as you said), so if you want to make repeat
> calls to a function (while making use of timeout.el's throttling), you'd
> have to store it somewhere.
Wouldn't the best thing to do to store this function
in a buffer-local variable? Then both its internal
lexically-bound variable and the timer will be unique
for every buffer.
Do you see a problem with this:
```
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 8a128df0d16..7085ce53966 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -2630,9 +2630,18 @@ project-mode-line-map
(defvar project-mode-line-face nil
"Face name to use for the project name on the mode line.")
-(defvar project-mode-line-format '(:eval (project-mode-line-format)))
+(defvar project-mode-line-format '(:eval (project-mode-line-buffer-local)))
(put 'project-mode-line-format 'risky-local-variable t)
+(defvar-local project-mode-line-buffer-local nil)
+
+(defun project-mode-line-buffer-local ()
+ (unless project-mode-line-buffer-local
+ (require 'timeout)
+ (setq-local project-mode-line-buffer-local
+ (timeout-throttled-func 'project-mode-line-format 5)))
+ (funcall project-mode-line-buffer-local))
+
(defun project-mode-line-format ()
"Compose the project mode-line."
(when-let* ((project (project-current)))
```
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: =?UTF-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 09 Dec 2025 17:18:01 +0000
Resent-Message-ID: <handler.78545.B78545.176530063831442 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Juri Linkov <juri@HIDDEN>
Cc: Yikai Zhao <yikai@HIDDEN>, 78545 <at> debbugs.gnu.org, Kristoffer Balintona <krisbalintona@HIDDEN>
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.176530063831442
(code B ref 78545); Tue, 09 Dec 2025 17:18:01 +0000
Received: (at 78545) by debbugs.gnu.org; 9 Dec 2025 17:17:18 +0000
Received: from localhost ([127.0.0.1]:55409 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vT1Kv-0008B3-NB
for submit <at> debbugs.gnu.org; Tue, 09 Dec 2025 12:17:18 -0500
Received: from mail-ua1-x92d.google.com ([2607:f8b0:4864:20::92d]:60432)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
id 1vT1Kt-0008Aj-0C
for 78545 <at> debbugs.gnu.org; Tue, 09 Dec 2025 12:17:15 -0500
Received: by mail-ua1-x92d.google.com with SMTP id
a1e0cc1a2514c-93a9f6efe7cso2900332241.0
for <78545 <at> debbugs.gnu.org>; Tue, 09 Dec 2025 09:17:14 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1765300629; x=1765905429; darn=debbugs.gnu.org;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=Zd+5hpn1jKFZoBxoCLkmogKV9ck9/BKoiUIUg0+S7Zw=;
b=kC1a1ls9q3rfivBiGNrV9+JdnuNdrkSfEYpncyDXEcEQDpnfvNXtCeHN1PoWVEBGZQ
A8Klr0TlUTzyYVrI/KQGMX4vRglhSOe7Qp6S+Q83HNk3iCE57/IYQ6NFCBi0aJaXeNLx
obc/FWEBuCLCEWgaRk2vY6q8x8wviToHg3gZBptTFWVqHAd0qg7J90oTIH03xFnDSgVu
Q5cRux/QH5hL27UM6uqWNaEWzpKWVOt1oQ+XP9/BFZq/wBI4gopPk1EmQ/g8jMABy6Zc
FF1e60+rXHBDTmrztSS5xcnapRlVzIzOeq3/98RMmG7Sg4rmzpJ7u/k59ThBSbdgc2uR
T1qA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1765300629; x=1765905429;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=Zd+5hpn1jKFZoBxoCLkmogKV9ck9/BKoiUIUg0+S7Zw=;
b=ITE+YblO1LkjOU+Rlqax8+UMjxiFi+WzQik6DbEgBVvPIjSchndvR/e/P2MKL489Eq
/1mDr8f4eA+GaAJj/ZfQGCxOtMm5Sydn/FfkNoh2cFQQj7HbK2tf0IHb4AvLf8qbb9bQ
d9Has031aMi7ace2aihzNnjws0ZSOrV503HNZOl8VFuuDCP7n425QwS/Xk5eYUC6OPQ7
I79G+y9vb3qrfpIO1Y6AYRxqwqWUpIxYngt1MwJ8yrioBVjdA9lJRDV3d1iZRllTZjl2
3xOqlpk+tCHukEFd/5CoFXNw31q+eFBmVkpiz86H/+6+M/UEtR+WValKgCVNZozHZP5y
gJgQ==
X-Forwarded-Encrypted: i=1;
AJvYcCWYPATvx7fkaORNZBMSqxLZLWnLj/5lulGJNfy7hq8VANxxsq8dIK+0NGFufeAA3D87OvoXnw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyfV8UynXomww0CnwBEbkq2zf4inBEP+ZH9uKSLW9+lHya0sldh
x5H530QQqLvgaA9oFZoKpqCjBKPmj97eXcSR5DFNsguv06QDvbtZK+5M1xr0Tjo8s77xrt8w3z8
soiQxx4rSrs3E04lfeHZJqi+2SAb3Eb0=
X-Gm-Gg: ASbGncszbMvxTfuYWcm7+s4z5MgFUI7cPfYaD218ddTtDTOwRII7VgNjOmhUQVgivZ+
GLAsQ+8464ZzAjgXMMpJm6HiusYPlWvUF+NSygxcnwENrTIG0rEyjUeL3o09AaXiVSCk3tcpHJU
G+7YENFSB2hYnBcrq22kC5xCLG0BPiTvvzcprmmIKryjrhRpBhwbdYDTAfCMDfDChy0DBrrQp2i
zTBaNtU9CTj/23GSciWDUYCP4Tngml/uJ3HYdzDHGs/rCAiyyB/Y1EHXS5MtNAFZgCHuDU=
X-Google-Smtp-Source: AGHT+IHsa8UUDmuvgMnWQUaop233b5VMLxWGSxqUsm5HzYiMMy4aKoquOh8+8CNvHH8PpIGyIUqWX4CzWCNDoWvu+e8=
X-Received: by 2002:a05:6102:5a97:b0:5df:3b19:4119 with SMTP id
ada2fe7eead31-5e52cbd368fmr3831546137.26.1765300628961; Tue, 09 Dec 2025
09:17:08 -0800 (PST)
MIME-Version: 1.0
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CANVbq5kzEuU2m0AmfDhOouHHHdtT5aZ=rCcH_oiLO8mLZwZaXg@HIDDEN>
<87sedk7sxh.fsf@HIDDEN>
<CANVbq5kM=4=YOVmvr6pOCK=rBOevYcxg6bAcefqyQwS6MqHdtQ@HIDDEN>
<87fr9kw2f7.fsf@HIDDEN>
<CANVbq5nFGLACwGFCM=DK=dDj=Wsyp+DiqXJ4LtuotB-H_CT-tA@HIDDEN>
<87h5tz4n0l.fsf@HIDDEN>
In-Reply-To: <87h5tz4n0l.fsf@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane?= Marks <shipmints@HIDDEN>
Date: Tue, 9 Dec 2025 12:16:56 -0500
X-Gm-Features: AQt7F2o0mUCp6mWQiIP6l6cflo07NzZ_MWK_kAFjhLWv3nzzY1iBoU_XQoIT8JI
Message-ID: <CAN+1HbpwZoY=hxeXnkJQkhNNXgHf79bLntiqkhMUh_Lzk=nJXQ@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000e93ca406458814a9"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
--000000000000e93ca406458814a9
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Tue, Dec 9, 2025 at 12:10=E2=80=AFPM Juri Linkov <juri@HIDDEN> wrote=
:
> >> I tried to use `timeout-throttled-func', but it always returns a new
> function.
> >
> > What I had in mind was storing the function returned by
> > `timeout-throttled-func' in a variable and calling that function in
> > `project-mode-line-format'. AFAIU, `timeout-throttled-func' returns a
> > new function every time (as you said), so if you want to make repeat
> > calls to a function (while making use of timeout.el's throttling), you'=
d
> > have to store it somewhere.
>
> Wouldn't the best thing to do to store this function
> in a buffer-local variable? Then both its internal
> lexically-bound variable and the timer will be unique
> for every buffer.
>
> Do you see a problem with this:
>
> ```
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index 8a128df0d16..7085ce53966 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -2630,9 +2630,18 @@ project-mode-line-map
> (defvar project-mode-line-face nil
> "Face name to use for the project name on the mode line.")
>
> -(defvar project-mode-line-format '(:eval (project-mode-line-format)))
> +(defvar project-mode-line-format '(:eval
> (project-mode-line-buffer-local)))
> (put 'project-mode-line-format 'risky-local-variable t)
>
> +(defvar-local project-mode-line-buffer-local nil)
> +
> +(defun project-mode-line-buffer-local ()
> + (unless project-mode-line-buffer-local
> + (require 'timeout)
> + (setq-local project-mode-line-buffer-local
> + (timeout-throttled-func 'project-mode-line-format 5)))
> + (funcall project-mode-line-buffer-local))
> +
> (defun project-mode-line-format ()
> "Compose the project mode-line."
> (when-let* ((project (project-current)))
> ```
>
My configuration uses a buffer-local cache for project and project root
treated as invariant for the buffer once computed. That seems to work
pretty well even though the cache doesn't invalidate itself. I also cache
"non-projects" to ensure that cache misses are also treated as invariants.
Once I create a project it pretty much remains in place its lifetime so
neither of these choices has had any visible impact and the resulting
performance is very good.
--000000000000e93ca406458814a9
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Tue, Dec 9, 2025 at 12:10=E2=80=AFPM Juri Linkov <<a href=3D"mailto:j=
uri@HIDDEN">juri@HIDDEN</a>> wrote:</span></div></div><div class=
=3D"gmail_quote gmail_quote_container"><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padd=
ing-left:1ex">>> I tried to use `timeout-throttled-func', but it =
always returns a new function.<br>
><br>
> What I had in mind was storing the function returned by<br>
> `timeout-throttled-func' in a variable and calling that function i=
n<br>
> `project-mode-line-format'. AFAIU, `timeout-throttled-func' re=
turns a<br>
> new function every time (as you said), so if you want to make repeat<b=
r>
> calls to a function (while making use of timeout.el's throttling),=
you'd<br>
> have to store it somewhere.<br>
<br>
Wouldn't the best thing to do to store this function<br>
in a buffer-local variable?=C2=A0 Then both its internal <br>
lexically-bound variable and the timer will be unique<br>
for every buffer.<br>
<br>
Do you see a problem with this:<br>
<br>
```<br>
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el<br>
index 8a128df0d16..7085ce53966 100644<br>
--- a/lisp/progmodes/project.el<br>
+++ b/lisp/progmodes/project.el<br>
@@ -2630,9 +2630,18 @@ project-mode-line-map<br>
=C2=A0(defvar project-mode-line-face nil<br>
=C2=A0 =C2=A0"Face name to use for the project name on the mode line.&=
quot;)<br>
<br>
-(defvar project-mode-line-format '(:eval (project-mode-line-format)))<=
br>
+(defvar project-mode-line-format '(:eval (project-mode-line-buffer-loc=
al)))<br>
=C2=A0(put 'project-mode-line-format 'risky-local-variable t)<br>
<br>
+(defvar-local project-mode-line-buffer-local nil)<br>
+<br>
+(defun project-mode-line-buffer-local ()<br>
+=C2=A0 (unless project-mode-line-buffer-local<br>
+=C2=A0 =C2=A0 (require 'timeout)<br>
+=C2=A0 =C2=A0 (setq-local project-mode-line-buffer-local<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (timeout-throttled=
-func 'project-mode-line-format 5)))<br>
+=C2=A0 (funcall project-mode-line-buffer-local))<br>
+<br>
=C2=A0(defun project-mode-line-format ()<br>
=C2=A0 =C2=A0"Compose the project mode-line."<br>
=C2=A0 =C2=A0(when-let* ((project (project-current)))<br>
```<br></blockquote><div><br></div><div class=3D"gmail_default" style=3D"fo=
nt-family:monospace">My configuration uses a buffer-local cache for project=
and project root treated as invariant for the buffer once computed. That s=
eems to work pretty well even though the cache doesn't invalidate itsel=
f.=C2=A0 I also cache "non-projects" to ensure that cache misses =
are also treated as invariants.=C2=A0 Once I create a project it pretty muc=
h remains in place its lifetime so neither of these choices has had any vis=
ible impact and the resulting performance is very good.</div></div></div>
--000000000000e93ca406458814a9--
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Kristoffer Balintona <krisbalintona@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 10 Dec 2025 00:43:02 +0000
Resent-Message-ID: <handler.78545.B78545.17653273603242 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Juri Linkov <juri@HIDDEN>
Cc: Yikai Zhao <yikai@HIDDEN>, 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.17653273603242
(code B ref 78545); Wed, 10 Dec 2025 00:43:02 +0000
Received: (at 78545) by debbugs.gnu.org; 10 Dec 2025 00:42:40 +0000
Received: from localhost ([127.0.0.1]:56736 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vT8Hw-0000qE-3r
for submit <at> debbugs.gnu.org; Tue, 09 Dec 2025 19:42:40 -0500
Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]:47195)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <krisbalintona@HIDDEN>)
id 1vT8Ht-0000pz-TA
for 78545 <at> debbugs.gnu.org; Tue, 09 Dec 2025 19:42:38 -0500
Received: by mail-lf1-x131.google.com with SMTP id
2adb3069b0e04-597de27b241so5620166e87.2
for <78545 <at> debbugs.gnu.org>; Tue, 09 Dec 2025 16:42:37 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1765327351; x=1765932151; darn=debbugs.gnu.org;
h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
:from:from:to:cc:subject:date:message-id:reply-to;
bh=jkcyW/yzMH3+pR39cKYMCACh6MSklsvEwVh7lIpPl3Q=;
b=k4Q5yFvqpvuFrTK4GP+cUbF3gWXeDVjJ0AupE0JiirLX/dRGPa/5+Rs3NbdYdXXawr
v9LGhWO6Tndo3AeoYt2km29IvT3dkIuFbZMZfqctLK6X/3CMsSNAwoINBgThkfDGtjDd
D16FWMkALGL8kh9EJHwiRNRSJiSJYN8ARn9u5o3nK9vn2+HSwJjEaXCgFFyCVLZIvjSd
WQfu7l1XO4fRxeKD8+OxSS1gsRBiHQlhsMboNLDl4pI6uSfm8qojdj1CvL+6d9fcKYVy
p4bAk1ECsrpqZLOzaK8/fZG2ukkjY+dSF/J2EKYLl7kk4UfjTXfsQE6igCH9nWoRIwi/
IVZA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1765327351; x=1765932151;
h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=jkcyW/yzMH3+pR39cKYMCACh6MSklsvEwVh7lIpPl3Q=;
b=CNLPT0vifxyZA2Ic9WIz8AJoCMhGJM1UyXnLjS4n1JHETxGukTv3R61p77cp4WVOwI
7FgkgC6Oi+1oO+4B0sNyKdZHUS26QJePaxcxa2bKs8vD4jzrNaJHfUYejSdnQVJ2C4iD
vMH24V6vAqJzT3r5jfkZxKNbGZGnA1iAhBpoS62RQn10uLjUETjT/Lc8Uv2kt25lEOfd
+KS/2I4Jh/kU4CWr08IhTjmGAUi0cSEqPElDwhUaIWvTAy1HxTzprS3uRvFWUNQIUJ9p
QqBUDPErK9iuum15OeiFsiWNmTQPuUlPG+NGKVIpdg/owdFSV1BVmnegX+/lorpZBrDr
58iw==
X-Forwarded-Encrypted: i=1;
AJvYcCVawUqaHKykJp1F+pB+71aszAdeiijoxvAEc4mf/0bENUjHWXXEF0bsMaDg7xX/Uxdm7ESRGg==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yw9imc+k+SapkUwSOWKJ0jfhepEhOOPLJQ1z+X9yYsG2j9vugd/
8oNukpuQswuVo6BbIo9wyIKhvonGD5XpZhyjQQd8UDRmM7F5ba/ICul9LI+uxBquSTPmOOdSP/h
FqQL9wA1fBFdFldLCIRaObdI/V38bLec=
X-Gm-Gg: ASbGnctWWWTEJ+WW3v/c4Yj4ZA18IK/5lBB7mj7Zq67SZwdfPThTPD/Xm0zi4EQ6+Bx
mxFs9cDDhpfKMijYjdSwBhTCvQf5TckRFh4bwEdYMj0XlpIACGPD+XQKmumIz1YtvbQBp8HSLjh
DVjmckOttrCAm7reeFh9XvQEVFI0MOWy4fmPFgpfmcP3DDPI8a7NEsG3FxIUBtJ96dmoj8m2stG
TP5UsA3PexDBXn4xJ9yxAq+ZmE7AFwSYjTeAsGU3U3rVBzXJbADQXvXJjNdFGTiN13R8EA=
X-Google-Smtp-Source: AGHT+IFSaEj+FoCO63ywmvVi2tU96mgPjgc0SUFVeLYpVzzoW0cgAUVUUqKSFnOcxH97w9guUScJumYAMtCHyEn/0MA=
X-Received: by 2002:a05:6512:33d5:b0:578:75b3:4326 with SMTP id
2adb3069b0e04-598ee52e6a9mr276436e87.29.1765327351065; Tue, 09 Dec 2025
16:42:31 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
HTTPREST; Tue, 9 Dec 2025 19:42:30 -0500
Received: from 753933720722 named unknown by gmailapi.google.com with
HTTPREST; Tue, 9 Dec 2025 19:42:30 -0500
From: Kristoffer Balintona <krisbalintona@HIDDEN>
In-Reply-To: <87h5tz4n0l.fsf@HIDDEN>
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CANVbq5kzEuU2m0AmfDhOouHHHdtT5aZ=rCcH_oiLO8mLZwZaXg@HIDDEN>
<87sedk7sxh.fsf@HIDDEN>
<CANVbq5kM=4=YOVmvr6pOCK=rBOevYcxg6bAcefqyQwS6MqHdtQ@HIDDEN>
<87fr9kw2f7.fsf@HIDDEN>
<CANVbq5nFGLACwGFCM=DK=dDj=Wsyp+DiqXJ4LtuotB-H_CT-tA@HIDDEN>
<87h5tz4n0l.fsf@HIDDEN>
MIME-Version: 1.0
Date: Tue, 9 Dec 2025 19:42:30 -0500
X-Gm-Features: AQt7F2pqWNAdMPY8PFhg-QTXoYn_bkX4qv8dg86ahw2JfkRLbHAaoHpFUCMHvvw
Message-ID: <CANVbq5=XM0f7Ud9wyqXjTNa+k83agbnRKkUWkEx6+7ynYYpRjg@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On Tue, Dec 09 2025, Juri Linkov wrote:
>>> I tried to use `timeout-throttled-func', but it always returns a new function.
>>
>> What I had in mind was storing the function returned by
>> `timeout-throttled-func' in a variable and calling that function in
>> `project-mode-line-format'. AFAIU, `timeout-throttled-func' returns a
>> new function every time (as you said), so if you want to make repeat
>> calls to a function (while making use of timeout.el's throttling), you'd
>> have to store it somewhere.
>
> Wouldn't the best thing to do to store this function
> in a buffer-local variable? Then both its internal
> lexically-bound variable and the timer will be unique
> for every buffer.
>
> Do you see a problem with this:
>
> ```
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index 8a128df0d16..7085ce53966 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -2630,9 +2630,18 @@ project-mode-line-map
> (defvar project-mode-line-face nil
> "Face name to use for the project name on the mode line.")
>
> -(defvar project-mode-line-format '(:eval (project-mode-line-format)))
> +(defvar project-mode-line-format '(:eval (project-mode-line-buffer-local)))
> (put 'project-mode-line-format 'risky-local-variable t)
>
> +(defvar-local project-mode-line-buffer-local nil)
> +
> +(defun project-mode-line-buffer-local ()
> + (unless project-mode-line-buffer-local
> + (require 'timeout)
> + (setq-local project-mode-line-buffer-local
> + (timeout-throttled-func 'project-mode-line-format 5)))
> + (funcall project-mode-line-buffer-local))
> +
> (defun project-mode-line-format ()
> "Compose the project mode-line."
> (when-let* ((project (project-current)))
> ```
Ah, I see what you mean now. That should work, right? Since each buffer
gets their own (throttled) `project-mode-line-format' function.
--
Kind regards,
Kristoffer
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Juri Linkov <juri@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 10 Dec 2025 07:21:01 +0000
Resent-Message-ID: <handler.78545.B78545.176535124123735 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Kristoffer Balintona <krisbalintona@HIDDEN>
Cc: Yikai Zhao <yikai@HIDDEN>, 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.176535124123735
(code B ref 78545); Wed, 10 Dec 2025 07:21:01 +0000
Received: (at 78545) by debbugs.gnu.org; 10 Dec 2025 07:20:41 +0000
Received: from localhost ([127.0.0.1]:58344 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vTEV7-0006Aj-Cj
for submit <at> debbugs.gnu.org; Wed, 10 Dec 2025 02:20:41 -0500
Received: from mout-p-201.mailbox.org ([80.241.56.171]:44516)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1vTEV5-0006AQ-5G
for 78545 <at> debbugs.gnu.org; Wed, 10 Dec 2025 02:20:39 -0500
Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4dR6Z66x5sz9tr3;
Wed, 10 Dec 2025 08:20:30 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1765351231;
h=from:from: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;
bh=w9C6ic94pHsPcTYAzns/iFcJC8WlbWTotg19+CNnDxs=;
b=YbxaUcbfAs/AUmobOj2Ysd9gt/pf9lP23kassFJwUkGgoHWcoCmkw+C3rbZ3bce3zEqBPN
qazcfPRrlJzFbP6PgBz2fmnbzNyLKWVom+uxygjd48ZaET4sdwVHRrnR600ZDnXFhW0xfI
Fq3g1nh9CLyQqR+lQSOw7GLhgfLzJwpbIZ/hXL7tQuiC0Ii5XBE9PfxqvTemmsaEQHv4+3
bD0myuFND4SP1bMdiKcrsA6m1vKBnwhLjBEArxTI6G5cFELc58pfhGBL7Ov78jBltpj9U7
vYhvtEvv2y8cwpTyteqrE/NM8Zk/oHmqjZsqo6igp/it0dMTwXbzhkgchuRFow==
From: Juri Linkov <juri@HIDDEN>
In-Reply-To: <CANVbq5=XM0f7Ud9wyqXjTNa+k83agbnRKkUWkEx6+7ynYYpRjg@HIDDEN>
Organization: LINKOV.NET
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CANVbq5kzEuU2m0AmfDhOouHHHdtT5aZ=rCcH_oiLO8mLZwZaXg@HIDDEN>
<87sedk7sxh.fsf@HIDDEN>
<CANVbq5kM=4=YOVmvr6pOCK=rBOevYcxg6bAcefqyQwS6MqHdtQ@HIDDEN>
<87fr9kw2f7.fsf@HIDDEN>
<CANVbq5nFGLACwGFCM=DK=dDj=Wsyp+DiqXJ4LtuotB-H_CT-tA@HIDDEN>
<87h5tz4n0l.fsf@HIDDEN>
<CANVbq5=XM0f7Ud9wyqXjTNa+k83agbnRKkUWkEx6+7ynYYpRjg@HIDDEN>
Date: Wed, 10 Dec 2025 09:19:36 +0200
Message-ID: <87h5tyls6v.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
>> -(defvar project-mode-line-format '(:eval (project-mode-line-format)))
>> +(defvar project-mode-line-format '(:eval (project-mode-line-buffer-local)))
>> (put 'project-mode-line-format 'risky-local-variable t)
>>
>> +(defvar-local project-mode-line-buffer-local nil)
>> +
>> +(defun project-mode-line-buffer-local ()
>> + (unless project-mode-line-buffer-local
>> + (require 'timeout)
>> + (setq-local project-mode-line-buffer-local
>> + (timeout-throttled-func 'project-mode-line-format 5)))
>> + (funcall project-mode-line-buffer-local))
>> ```
>
> Ah, I see what you mean now. That should work, right? Since each buffer
> gets their own (throttled) `project-mode-line-format' function.
It works indeed. And maybe we should add a new choice value 'buffer-local'
to the customizable option 'project-mode-line' for this feature.
BTW, I found a bug in 'timeout-throttled-func'.
Initially the function returns nil, so no project name
is displayed on the mode-line. I posted the fix to bug#79979.
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Kristoffer Balintona <krisbalintona@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 10 Dec 2025 15:30:02 +0000
Resent-Message-ID: <handler.78545.B78545.17653805491444 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Juri Linkov <juri@HIDDEN>
Cc: Yikai Zhao <yikai@HIDDEN>, 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.17653805491444
(code B ref 78545); Wed, 10 Dec 2025 15:30:02 +0000
Received: (at 78545) by debbugs.gnu.org; 10 Dec 2025 15:29:09 +0000
Received: from localhost ([127.0.0.1]:34920 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vTM7p-0000NE-GH
for submit <at> debbugs.gnu.org; Wed, 10 Dec 2025 10:29:09 -0500
Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]:59880)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <krisbalintona@HIDDEN>)
id 1vTM7l-0000MY-1W
for 78545 <at> debbugs.gnu.org; Wed, 10 Dec 2025 10:29:07 -0500
Received: by mail-lf1-x129.google.com with SMTP id
2adb3069b0e04-598eaafa587so2126949e87.3
for <78545 <at> debbugs.gnu.org>; Wed, 10 Dec 2025 07:29:04 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1765380538; x=1765985338; darn=debbugs.gnu.org;
h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
:from:from:to:cc:subject:date:message-id:reply-to;
bh=zsAvxeXNdtUumfi30ACv/T7JV45hqNV8AfQ/3uyK+Pc=;
b=irmDMQJP1qNgSxEa2J23ocLAlxiCrCqaArbwfDIegt9RD5IUGtP39rCkUDYupEd2qA
14Nc1soWgrKuN+mS2hdB1vagxhfnxlLzX6536yNpnGdZ31ZEIC1Nd4ezb1E6SQXALXJO
dCgmGwS8ars/TWnz2EHEe5G+DK4dPnAbQhEIJf2aMYrcPV7cY3sEAh0CaPOAcSY3MDaz
qPBP5V6ow1cyjEkflZySczvQxXnMTpwObhxQ0vZdYT0z+YQWHIuHHhUh1k3MDXAGdiO9
4J4Hl2VMb/uCyEyWKqfMLu9yAogf1Kl0HRsUo80i8nhFLR9FRa32cs9B0APLNUl1TLi/
q8JA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1765380538; x=1765985338;
h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=zsAvxeXNdtUumfi30ACv/T7JV45hqNV8AfQ/3uyK+Pc=;
b=PUFhHkMsRYPbMbITxZl50lpckURJfbv8DXkVedfjL+eZq2QGdvCwKByVTuyeV+i0HW
89NMqjFZv7FHZCUqt/tY1wzqEompkU7BYqGfWJ1qOc6Hx1M0sTmUbazTU051J/5g7Q+P
yRQ/bORC8fn6MYjnhxIjrxUOKoynMMuCvxfxnWFHbQSsmNRMFUCuVnbFyA9zgBnN8ISo
LvwGbyHKspRl0jkp8IZocUdqQM0Yz79Ey3TaJkEjsrm1eF2BQ3HOI2CLKYxPlMAGsLYi
eIaDIVRlL+jcXZVZdykkYYM3YR0SD3FEkhU7NIRcunGizKYMxasqq1hvLgPETyecLXTN
pN9w==
X-Forwarded-Encrypted: i=1;
AJvYcCVHxPuM8jH9vrFuqfgw2Jz/qHSpTHl7I4Fwz+PJDODLENRQ9UXvJMcXJ3V/GasPsaBQp0XpWQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwgeXWXS7X72hNMFFwih1S0T+6gPvOQm7Yl2CjXrqV5Zck8XZvg
yGh/JA7d7jSXtcwZAjtpBsJSYGy/elNU17QHDJGaj8YhCkAmFGxASS/kdtJap78aQXDtUgnmJpw
l1T5HCp0QtFszChZ2epL8HfqVpkEO/Wc=
X-Gm-Gg: AY/fxX5JjHdBRPD9s8aP6ljhyKLWYS5ue51qjXG3noExY93g9XC1fvl7CIKDRYwkD5z
U/D/dstNt2bSuuoxOD5e50ilQFny+ji3TCI3VvQo7NmPC8KAKR6FM5ieFh3q/BOeRHDua5gzt0G
QyLRxIIZ6QGOu3PcyMzX1MDJXxltNT3nToLTOqNLQWkN9epyoA3K9KCEWe3XCRrMV0Mh5Wn3ys3
o1BavIRUNRRgI++msYWeFHcc00anWYc8UQbAAOSFM4eG/96h+u885lbOGFhK8NfETKAuEA=
X-Google-Smtp-Source: AGHT+IHEbNKUNcIu5Erox9IhIsK/Ofr1V0M6Q/Co8KG/bNnUziCaIW7OeovXSX1d3vbQUQ5I/fcGIXK8xHROePp4q4o=
X-Received: by 2002:a05:6512:1558:b0:598:eecb:c330 with SMTP id
2adb3069b0e04-598eecbc38emr776162e87.4.1765380537861; Wed, 10 Dec 2025
07:28:57 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
HTTPREST; Wed, 10 Dec 2025 07:28:57 -0800
Received: from 753933720722 named unknown by gmailapi.google.com with
HTTPREST; Wed, 10 Dec 2025 07:28:57 -0800
From: Kristoffer Balintona <krisbalintona@HIDDEN>
In-Reply-To: <87h5tyls6v.fsf@HIDDEN>
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CANVbq5kzEuU2m0AmfDhOouHHHdtT5aZ=rCcH_oiLO8mLZwZaXg@HIDDEN>
<87sedk7sxh.fsf@HIDDEN>
<CANVbq5kM=4=YOVmvr6pOCK=rBOevYcxg6bAcefqyQwS6MqHdtQ@HIDDEN>
<87fr9kw2f7.fsf@HIDDEN>
<CANVbq5nFGLACwGFCM=DK=dDj=Wsyp+DiqXJ4LtuotB-H_CT-tA@HIDDEN>
<87h5tz4n0l.fsf@HIDDEN>
<CANVbq5=XM0f7Ud9wyqXjTNa+k83agbnRKkUWkEx6+7ynYYpRjg@HIDDEN>
<87h5tyls6v.fsf@HIDDEN>
MIME-Version: 1.0
Date: Wed, 10 Dec 2025 07:28:57 -0800
X-Gm-Features: AQt7F2qe7f5o9ATQB45yhdACdm-i3hFekfwitmgRzNCAFPqsOc0tSOhFJe2lL9E
Message-ID: <CANVbq5n=virjVGQMeKBw1fn5NLXQXDTK4kF98ZLnkdEBQr4j_g@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On Wed, Dec 10 2025, Juri Linkov wrote:
>>> -(defvar project-mode-line-format '(:eval (project-mode-line-format)))
>>> +(defvar project-mode-line-format '(:eval (project-mode-line-buffer-local)))
>>> (put 'project-mode-line-format 'risky-local-variable t)
>>>
>>> +(defvar-local project-mode-line-buffer-local nil)
>>> +
>>> +(defun project-mode-line-buffer-local ()
>>> + (unless project-mode-line-buffer-local
>>> + (require 'timeout)
>>> + (setq-local project-mode-line-buffer-local
>>> + (timeout-throttled-func 'project-mode-line-format 5)))
>>> + (funcall project-mode-line-buffer-local))
>>> ```
>>
>> Ah, I see what you mean now. That should work, right? Since each buffer
>> gets their own (throttled) `project-mode-line-format' function.
>
> It works indeed. And maybe we should add a new choice value 'buffer-local'
> to the customizable option 'project-mode-line' for this feature.
Should we decide what the throttle interval/duration should be or should
we let users decide (via an option)? For me, at least, 5 seconds is too
long. I wasn't noticing a performance degradation at sub 1-second
durations.
--
Kind regards,
Kristoffer
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Juri Linkov <juri@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 10 Dec 2025 17:44:02 +0000
Resent-Message-ID: <handler.78545.B78545.17653885884915 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Kristoffer Balintona <krisbalintona@HIDDEN>
Cc: Yikai Zhao <yikai@HIDDEN>, 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.17653885884915
(code B ref 78545); Wed, 10 Dec 2025 17:44:02 +0000
Received: (at 78545) by debbugs.gnu.org; 10 Dec 2025 17:43:08 +0000
Received: from localhost ([127.0.0.1]:35676 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vTODT-0001HD-Ul
for submit <at> debbugs.gnu.org; Wed, 10 Dec 2025 12:43:08 -0500
Received: from mout-p-201.mailbox.org ([80.241.56.171]:32892)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1vTODR-0001Gg-ON
for 78545 <at> debbugs.gnu.org; Wed, 10 Dec 2025 12:43:06 -0500
Received: from smtp2.mailbox.org (smtp2.mailbox.org
[IPv6:2001:67c:2050:b231:465::2])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4dRNNJ6HZPz9tk3;
Wed, 10 Dec 2025 18:42:56 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1765388576;
h=from:from: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;
bh=+z1gooS7d4EEoTYsP2Sn2XEjYjTVLsCSPCLbUWhQxxo=;
b=IFPneKrDmeoG6rR6bvAfVW5mb+vCeoN1ODP6enoWG/oE/B5zkzSX/y6+9gFYDp+GhEbvFE
RdG1UzDF1l3aZF56DssTclTdb433GTCsy8xBFy31rwf/1vbrS+YQk1KSd4yb2Yl3w88c3Y
HaEA33EhP90dbrDNiFyjKf/mgIe0NvO7k112McC3l4xI9jm8G3Tpn3ey7UEZ1XlK1G9cvZ
Y+HE88Eyz+fwg9YMAKOvZyXElTaWsHuYEc3nmmvV4Wynd6g43DaKdmqwcvkRChNaIv5bjD
VwHeHxznPZOluycXqPiQNPh2/KL4dnH7BBn0ZOw3zKQLz/ch5qXt58mtrzm84A==
Authentication-Results: outgoing_mbo_mout; dkim=none;
spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates
2001:67c:2050:b231:465::2 as permitted sender) smtp.mailfrom=juri@HIDDEN
From: Juri Linkov <juri@HIDDEN>
In-Reply-To: <CANVbq5n=virjVGQMeKBw1fn5NLXQXDTK4kF98ZLnkdEBQr4j_g@HIDDEN>
Organization: LINKOV.NET
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CANVbq5kzEuU2m0AmfDhOouHHHdtT5aZ=rCcH_oiLO8mLZwZaXg@HIDDEN>
<87sedk7sxh.fsf@HIDDEN>
<CANVbq5kM=4=YOVmvr6pOCK=rBOevYcxg6bAcefqyQwS6MqHdtQ@HIDDEN>
<87fr9kw2f7.fsf@HIDDEN>
<CANVbq5nFGLACwGFCM=DK=dDj=Wsyp+DiqXJ4LtuotB-H_CT-tA@HIDDEN>
<87h5tz4n0l.fsf@HIDDEN>
<CANVbq5=XM0f7Ud9wyqXjTNa+k83agbnRKkUWkEx6+7ynYYpRjg@HIDDEN>
<87h5tyls6v.fsf@HIDDEN>
<CANVbq5n=virjVGQMeKBw1fn5NLXQXDTK4kF98ZLnkdEBQr4j_g@HIDDEN>
Date: Wed, 10 Dec 2025 19:41:38 +0200
Message-ID: <87wm2ugrot.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Queue-Id: 4dRNNJ6HZPz9tk3
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
>>>> -(defvar project-mode-line-format '(:eval (project-mode-line-format)))
>>>> +(defvar project-mode-line-format '(:eval (project-mode-line-buffer-local)))
>>>> (put 'project-mode-line-format 'risky-local-variable t)
>>>>
>>>> +(defvar-local project-mode-line-buffer-local nil)
>>>> +
>>>> +(defun project-mode-line-buffer-local ()
>>>> + (unless project-mode-line-buffer-local
>>>> + (require 'timeout)
>>>> + (setq-local project-mode-line-buffer-local
>>>> + (timeout-throttled-func 'project-mode-line-format 5)))
>>>> + (funcall project-mode-line-buffer-local))
>>>> ```
>>>
>>> Ah, I see what you mean now. That should work, right? Since each buffer
>>> gets their own (throttled) `project-mode-line-format' function.
>>
>> It works indeed. And maybe we should add a new choice value 'buffer-local'
>> to the customizable option 'project-mode-line' for this feature.
>
> Should we decide what the throttle interval/duration should be or should
> we let users decide (via an option)? For me, at least, 5 seconds is too
> long. I wasn't noticing a performance degradation at sub 1-second
> durations.
Yes, we could add a numeric field to specify a duration
in the 'project-mode-line' option.
X-Loop: help-debbugs@HIDDEN
Subject: bug#78545: 31.0.50; project-mode-line is slow because it tries to read files on each update
Resent-From: Juri Linkov <juri@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 12 Dec 2025 07:46:02 +0000
Resent-Message-ID: <handler.78545.B78545.176552553623224 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78545
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Kristoffer Balintona <krisbalintona@HIDDEN>
Cc: Dmitry Gutov <dmitry@HIDDEN>, Yikai Zhao <yikai@HIDDEN>, 78545 <at> debbugs.gnu.org
Received: via spool by 78545-submit <at> debbugs.gnu.org id=B78545.176552553623224
(code B ref 78545); Fri, 12 Dec 2025 07:46:02 +0000
Received: (at 78545) by debbugs.gnu.org; 12 Dec 2025 07:45:36 +0000
Received: from localhost ([127.0.0.1]:53507 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vTxqJ-00061C-IQ
for submit <at> debbugs.gnu.org; Fri, 12 Dec 2025 02:45:36 -0500
Received: from mout-p-103.mailbox.org ([2001:67c:2050:0:465::103]:54890)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1vTxqG-0005Td-DS
for 78545 <at> debbugs.gnu.org; Fri, 12 Dec 2025 02:45:33 -0500
Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4dSM1r5LLWz9ssQ;
Fri, 12 Dec 2025 08:45:20 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1765525520;
h=from:from: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;
bh=VqdteCAuPGZVA44YMb0YMdU8Q2Mste/gHLRrzf6rIco=;
b=UPNZbqRVyXIe+RBSrdyshaHlMbUZwxkAcnRr84Bd7GLlxUI4MPxMOEcmMHlR5tR3X79uIh
b/itQgNZ/bYBGp5jQwQ6P07rWOegLf3xPjjdkAvO50wIM9kXll6gBmSkav6vkP2nvqo/QB
DBg4DrMS0iKQQnbFMZ5nLoc2rHMY1MOVS8yAkKCntMH43KkF95h8AxoAEpaDrvx2aJEHAc
3TxlLfl0k+MV0gGHli5hcpO9QEJnk+6INvS62PQU6rCg4D4r+n6w1pZOUgyQfpAZCzJm3s
tTNRncxKd5cS7U3L93nIgbMi/+yW7f0lL38+LSi7HNBDG+PAn34e7X4x5GoUQg==
From: Juri Linkov <juri@HIDDEN>
In-Reply-To: <87wm2ugrot.fsf@HIDDEN>
Organization: LINKOV.NET
References: <CANMyjphvpx-9hhycBvut2q4-QDZaOzWWdLMBn13XcZfDuusx4Q@HIDDEN>
<CANVbq5kzEuU2m0AmfDhOouHHHdtT5aZ=rCcH_oiLO8mLZwZaXg@HIDDEN>
<87sedk7sxh.fsf@HIDDEN>
<CANVbq5kM=4=YOVmvr6pOCK=rBOevYcxg6bAcefqyQwS6MqHdtQ@HIDDEN>
<87fr9kw2f7.fsf@HIDDEN>
<CANVbq5nFGLACwGFCM=DK=dDj=Wsyp+DiqXJ4LtuotB-H_CT-tA@HIDDEN>
<87h5tz4n0l.fsf@HIDDEN>
<CANVbq5=XM0f7Ud9wyqXjTNa+k83agbnRKkUWkEx6+7ynYYpRjg@HIDDEN>
<87h5tyls6v.fsf@HIDDEN>
<CANVbq5n=virjVGQMeKBw1fn5NLXQXDTK4kF98ZLnkdEBQr4j_g@HIDDEN>
<87wm2ugrot.fsf@HIDDEN>
Date: Fri, 12 Dec 2025 09:43:57 +0200
Message-ID: <87qzt0b0w2.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
>>>>> +(defun project-mode-line-buffer-local ()
>>>>> + (unless project-mode-line-buffer-local
>>>>> + (require 'timeout)
>>>>> + (setq-local project-mode-line-buffer-local
>>>>> + (timeout-throttled-func 'project-mode-line-format 5)))
>>>>> + (funcall project-mode-line-buffer-local))
>>>>
>>>> Ah, I see what you mean now. That should work, right? Since each buffer
>>>> gets their own (throttled) `project-mode-line-format' function.
>>>
>>> It works indeed. And maybe we should add a new choice value 'buffer-local'
>>> to the customizable option 'project-mode-line' for this feature.
>>
>> Should we decide what the throttle interval/duration should be or should
>> we let users decide (via an option)? For me, at least, 5 seconds is too
>> long. I wasn't noticing a performance degradation at sub 1-second
>> durations.
>
> Yes, we could add a numeric field to specify a duration
> in the 'project-mode-line' option.
While it's easy to throttle 'project-mode-line-format',
I'm still not sure if this should be implemented at a lower level.
There is such comment in 'project-try-vc':
;; FIXME: Cache for a shorter time.
(let ((res (project-try-vc--search dir)))
(and res (vc-file-setprop dir 'project-vc res))
res)
Also caching 'project-name' in a buffer-local variable
was discussed earlier as well.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.