From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#60107: 30.0.50; Open new files very slow if eglot and which-function-mode are enabled. Date: Thu, 15 Dec 2022 23:44:54 +0000 Message-ID: References: <87edt0mg7p.fsf@web.de> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000002bad8f05efe66cec" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26284"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60107@debbugs.gnu.org To: Felix Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 16 00:44:18 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p5xth-0006cQ-Jt for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Dec 2022 00:44:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5xtT-0001rX-80; Thu, 15 Dec 2022 18:44:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5xtR-0001r8-Uz for bug-gnu-emacs@gnu.org; Thu, 15 Dec 2022 18:44:01 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p5xtR-0003r6-Ms for bug-gnu-emacs@gnu.org; Thu, 15 Dec 2022 18:44:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p5xtR-0005TE-J6 for bug-gnu-emacs@gnu.org; Thu, 15 Dec 2022 18:44:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Dec 2022 23:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60107 X-GNU-PR-Package: emacs Original-Received: via spool by 60107-submit@debbugs.gnu.org id=B60107.167114782921013 (code B ref 60107); Thu, 15 Dec 2022 23:44:01 +0000 Original-Received: (at 60107) by debbugs.gnu.org; 15 Dec 2022 23:43:49 +0000 Original-Received: from localhost ([127.0.0.1]:45637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5xtE-0005Sr-R8 for submit@debbugs.gnu.org; Thu, 15 Dec 2022 18:43:49 -0500 Original-Received: from mail-oi1-f182.google.com ([209.85.167.182]:33715) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5xtB-0005Sk-NQ for 60107@debbugs.gnu.org; Thu, 15 Dec 2022 18:43:47 -0500 Original-Received: by mail-oi1-f182.google.com with SMTP id c129so640775oia.0 for <60107@debbugs.gnu.org>; Thu, 15 Dec 2022 15:43:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=EpUpxT465CMyLzEzVsPpn2QNkmP6mh9qrBE9vvEr5mY=; b=dP8J9cNgAXjscpTXhdftbp2eMUXDwile93HtkJXgviZBJ62ynwnqxECsI0yPHyxdWY BvyGJx7lbP3P3JXSWBsw/IakqMoVLjAOgg2FEIgSSEAytl68e0/g43dgsRYn+1jSMqgr CGD7cZ2bg+Wg2oPRJ+x9S7bkTb7tiHpotsO/MXaOcyYpVfFds43/ZaPs1OHGVdjfcAcZ g9JcP8cTku5qUwlVqfQtNza6bDsqZfhEwP28pS95JKlsJe0R6/7h1jIUdygPAzFEVg0R T1W4BslDynrUOYIlqn/KvH1W3l4SP6ZyZTyUshwmxoSG/qu4F6tkwOJ7sLtf6WHaI2tv zzug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=EpUpxT465CMyLzEzVsPpn2QNkmP6mh9qrBE9vvEr5mY=; b=FWUyacxmjaLETQ4LrLJq8DO5IMtdZamBdMoSMS7xXEQzUSN36egvQ7/GHLXTDBFh9+ guZFVLwsc9trEvg7RweV2Z9hkDe/efMk379P+/9P3/XSFKD72NLTEmAZBeCGJZo9lC9q /HGAssx2N16JOA6+lH+shHLdTfGgH2GDhhJNOmkg19poV5oeN1tdCdjdOK2daG9WeBVJ IPukM/7iSgkZ3y8Sb0CscSiLz942AXDxrOBDEspgIeZVcsac00pHJVqbMJ7cCgYHMaMm qxIel/Rrs9mJgHgd5IdiFp8fx7UbYZL5avMM3eRIxS+FPHBS13OD9FR94DQHXIsx05GQ yY9g== X-Gm-Message-State: ANoB5pnyz6VMT9IocUuq/LqcZMvol8i/i2fc96U4ELquBGe7gcmwv32c Ujd3AkVNYsKsMYC1S1Vg7C5wglkEoKElzUgFJRs= X-Google-Smtp-Source: AA0mqf6b0qs7e559uFyRtQHUvan4mhVagstXHSxF2sfGacaRnY8Tyy/LfHWb39dvytLVChilEse/znOXKKd5HjzLqPI= X-Received: by 2002:aca:b03:0:b0:35e:4a14:8182 with SMTP id 3-20020aca0b03000000b0035e4a148182mr318244oil.171.1671147819869; Thu, 15 Dec 2022 15:43:39 -0800 (PST) In-Reply-To: <87edt0mg7p.fsf@web.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:251160 Archived-At: --0000000000002bad8f05efe66cec Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Felix, First of all, thanks for the easy-to-follow Emacs -Q reproduction recipe. I reproduced the problem, although in my own test, which used medium/small C++ files, the delay I noticed wasn't very long, about 1 second. Which-function-mode relies on Imenu, which is the keeper of a syntactic sub-tree of the file, which it must collect from somewhere. When Eglot is enabled, Imenu gets its tree from the LSP server. Depending on the LSP server and the amount of information at hand, this can be a lot of information and take some time to gather. It seems which-function-mode not only relies on Imenu but also blocks the user interface and redisplay while it is waiting for the Imenu backend to reply (the Imenu backend in this case being Eglot's). I don't see a good fix for this, except disabling Imenu/Eglot integration by adding the symbol 'imenu to eglot-stay-out-of (see the Eglot manual). It can also be that what's slowing down operation here isn't the collection of the syntax tree per se but the logging that is going on. See also the Eglot manual for how to configure eglot-events-buffer-size to see if it makes a difference or not.; Finally, you can probably get some other source for Imenu information to feed which-func-mode. The new C++ modes like c++-ts-mode seems to have similar information handy, and perhaps it takes a lot less time to compute. Jo=C3=A3o On Thu, Dec 15, 2022 at 10:57 PM Felix wrote: > > > > > In GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version > 3.24.35) of 2022-12-15 built on felix-lifebooka531 > Repository revision: 0d60579b6b6f2648a881572783322b1bcf931a73 > Repository branch: makepkg > Windowing system distributor 'The X.Org Foundation', version 11.0.1220100= 6 > System Description: Arch Linux > > Configured using: > 'configure --prefix=3D/usr --sysconfdir=3D/etc --libexecdir=3D/usr/lib > --localstatedir=3D/var --mandir=3D/usr/share/man --with-gameuser=3D:game= s > --with-modules --without-libotf --without-m17n-flt --without-gconf > --enable-autodepend --with-native-compilation=3Dyes --with-xinput2 > --with-x-toolkit=3Dgtk3 --without-xaw3d --without-cairo --with-sound=3Dn= o > --with-xwidgets --with-tree-sitter --without-gpm > --without-compress-install > '--program-transform-name=3Ds/\([ec]tags\)/\1.emacs/' > 'CFLAGS=3D-march=3Dnative -mtune=3Dgeneric -O3 -pipe -fno-plt -fexceptio= ns > -Wp,-D_FORTIFY_SOURCE=3D2 -Wformat -Werror=3Dformat-security > -fstack-clash-protection -fcf-protection' > LDFLAGS=3D-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' > > Configured features: > ACL DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LCMS2 > LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG > SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 > XDBE XFT XIM XINPUT2 XPM XWIDGETS GTK3 ZLIB > > Important settings: > value of $LANG: de_DE.UTF-8 > locale-coding-system: utf-8 > > > Opening C files is very slow if which-function-mode and eglot are > enabled at the same time. I tested this with: > > emacs -Q > opening a C project file > M-x eglot > M-x which-function-mode > switching to another .c project file now takes seconds until the buffer > shows up. > I use an old Laptop, but with just one of the two modes disabled, > it's quite snappy. > > > > --=20 Jo=C3=A3o T=C3=A1vora --0000000000002bad8f05efe66cec Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Felix,

First of all, than= ks for the easy-to-follow Emacs -Q reproduction
recipe.=C2= =A0 I reproduced the problem, although in my own test, which
used medium/small C++ files, the delay I noticed wasn't very long,
about 1 second.

Which-function-mode re= lies on Imenu, which is the keeper of
a syntactic sub-tree of the= file, which it must collect from somewhere.
When Eglot is enable= d, Imenu gets its tree from the LSP server.=C2=A0
Depending = on the LSP server and the amount of information at
hand, thi= s can be a lot of information and take some time to gather.
=
It seems which-function-mode not only relies on Imenu but al= so
blocks the user interface and redisplay while it is waiting fo= r the
Imenu backend to reply (the Imenu backend in this case= being
Eglot's).

I don't see= a good fix for this, except disabling Imenu/Eglot integration
by= adding the symbol 'imenu to eglot-stay-out-of (see the Eglot
manual).

It can also be that what's slow= ing down operation here isn't the
collection of the synt= ax tree per se but the logging that is going
on.=C2=A0 See also t= he Eglot manual for how to configure
eglot-events-buffer-siz= e to see if it makes a difference or not.;

Fin= ally, you can probably get some other source for Imenu information
to feed which-func-mode.=C2=A0 The new C++ modes like c++-ts-mode seems <= br>
to have similar information handy, and perhaps it takes a lot= less time
to compute.

Jo=C3=A3o
On Thu, D= ec 15, 2022 at 10:57 PM Felix <feli= x.dick@web.de> wrote:




In GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version
=C2=A03.24.35) of 2022-12-15 built on felix-lifebooka531
Repository revision: 0d60579b6b6f2648a881572783322b1bcf931a73
Repository branch: makepkg
Windowing system distributor 'The X.Org Foundation', version 11.0.1= 2201006
System Description: Arch Linux

Configured using:
=C2=A0'configure --prefix=3D/usr --sysconfdir=3D/etc --libexecdir=3D/us= r/lib
=C2=A0--localstatedir=3D/var --mandir=3D/usr/share/man --with-gameuser=3D:g= ames
=C2=A0--with-modules --without-libotf --without-m17n-flt --without-gconf =C2=A0--enable-autodepend --with-native-compilation=3Dyes --with-xinput2 =C2=A0--with-x-toolkit=3Dgtk3 --without-xaw3d --without-cairo --with-sound= =3Dno
=C2=A0--with-xwidgets --with-tree-sitter --without-gpm
=C2=A0--without-compress-install
=C2=A0'--program-transform-name=3Ds/\([ec]tags\)/\1.emacs/'
=C2=A0'CFLAGS=3D-march=3Dnative -mtune=3Dgeneric -O3 -pipe -fno-plt -fe= xceptions
=C2=A0-Wp,-D_FORTIFY_SOURCE=3D2 -Wformat -Werror=3Dformat-security
=C2=A0-fstack-clash-protection -fcf-protection'
=C2=A0LDFLAGS=3D-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
ACL DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11
XDBE XFT XIM XINPUT2 XPM XWIDGETS GTK3 ZLIB

Important settings:
=C2=A0 value of $LANG: de_DE.UTF-8
=C2=A0 locale-coding-system: utf-8


Opening C files is very slow if which-function-mode and eglot are
enabled at the same time. I tested this with:

emacs -Q
opening a C project file
M-x eglot
M-x which-function-mode
switching to another .c project file now takes seconds until the buffer
shows up.
I use an old Laptop, but with just one of the two modes disabled,
it's quite snappy.





--
Jo=C3=A3o T=C3=A1vora
--0000000000002bad8f05efe66cec--