GNU logs - #75922, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75922: CPU hogs with pgtk
Resent-From: Nicolas Sarlin <nico.sarlin@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 29 Jan 2025 11:16:02 +0000
Resent-Message-ID: <handler.75922.B.173814933427960 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 75922
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 75922 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.173814933427960
          (code B ref -1); Wed, 29 Jan 2025 11:16:02 +0000
Received: (at submit) by debbugs.gnu.org; 29 Jan 2025 11:15:34 +0000
Received: from localhost ([127.0.0.1]:40126 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1td62f-0007Gt-30
	for submit <at> debbugs.gnu.org; Wed, 29 Jan 2025 06:15:34 -0500
Received: from lists.gnu.org ([2001:470:142::17]:51348)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <nico.sarlin@HIDDEN>)
 id 1td5tB-0006p2-LO
 for submit <at> debbugs.gnu.org; Wed, 29 Jan 2025 06:05:46 -0500
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 <nico.sarlin@HIDDEN>)
 id 1td5t5-00063b-8v
 for bug-gnu-emacs@HIDDEN; Wed, 29 Jan 2025 06:05:39 -0500
Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <nico.sarlin@HIDDEN>)
 id 1td5t1-0002N1-7n
 for bug-gnu-emacs@HIDDEN; Wed, 29 Jan 2025 06:05:38 -0500
Received: by mail-oi1-x234.google.com with SMTP id
 5614622812f47-3eba347aa6fso4325324b6e.3
 for <bug-gnu-emacs@HIDDEN>; Wed, 29 Jan 2025 03:05:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1738148732; x=1738753532; darn=gnu.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=jqX6aWHEtLYViN4LPaa5TEj22qsooLHqoqKC0OXmIrU=;
 b=HqKaeOmpqY2YIz7qIW7vpV1Wp6r85VSXv0a6ZxyxOJ1rtvPZDTeMSFOcuv+PKit1+E
 mmCeSo1xmoo4UCfg2uhNynLPgZFd0URzYJcJJnvArKoh/j0/Cvnz+yUwXmAi2iMwoyPV
 VbVOo/0HkAxBEcFGNrypexPuAQdqsYDCSA+wh4Dd4ZLCZkesEIS5d/q/OTqmD205iGGY
 GiNn9V8k02wZ6IYiuNN0a34EEJCT/SOlCbYF+WDRoNA8+VL1hA0uNZqjPp/+H7HcGnuQ
 pn8j0x6ugGUYhNZ21VscdeIpgzMNCV7cLzqpf8OaKkZ7NiN6yanJ99ksonNxLqwR2xQd
 yk8w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1738148732; x=1738753532;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=jqX6aWHEtLYViN4LPaa5TEj22qsooLHqoqKC0OXmIrU=;
 b=s+9r4DDh22smuIJovCxR4F6jttYTjx3wZL6jFvFjpuEVI9fMjnj9qEjO/mZqPVuO5F
 zaCdHWRd5DH14ojNDA4yXfmLojJ7pF/iVECqiiQaLx56m4GLT+lUxyetyOpscmPdyboj
 8Dw+hRSAKbj1zrtoK5taTt+iQI/Q5ETNNIHGlpUcmb5AIhlE03C8CA9FKYAu038EVguM
 APos6mH6CGj4w8/U6TQbGowMMtxvZpJ9/HNeqYumC40goyz1WGI+GRnYjGU/+Q8NHlzM
 pN7cw6M+S/3cNpBW+NWJFlNSsrtIssZWJP0GWJNbY7FuxTwgF+2Pmt16GRp56Ecu9UoG
 YF4Q==
X-Gm-Message-State: AOJu0YwSyED3AyE4B4rwHNfi3/A7qvcDpU4OD7ccH4M/fT61cYN88cFA
 hB3izgSqrZdBt45yrvQ0vKe2jqPdCh/3UTouF5UbDHi3fTHw0Zn6PHR5rgcd0drAUHVcNxS08SV
 xpYYsCutiBVNYjtdyK8dEIXe/8kBlPrZgPlTznNQHdlA=
X-Gm-Gg: ASbGncuRlOA5O1IDIHNCvQSZgLjJzcBD8RapvQzV1ILILbT/2HI8GdCiyHDgwz1+bcq
 VzqqC93MXfMpV9lfc7y20UjhQ7RAy+beAEJi1RB4vRyzpOlMPnaQTyf9DvpWwhnq9fkGcM1XXew
 ==
X-Google-Smtp-Source: AGHT+IFXVl3ydMoM25Td+qaV86GrNUvaR63/bYAm+40xbis+XMTNxxokHPH8Ir8dAUAfGe9Qn8QWeG9tCmWML5yz1o4=
X-Received: by 2002:a05:6808:f09:b0:3f0:e42:4dab with SMTP id
 5614622812f47-3f323b6d832mr1177191b6e.33.1738148731594; Wed, 29 Jan 2025
 03:05:31 -0800 (PST)
MIME-Version: 1.0
From: Nicolas Sarlin <nico.sarlin@HIDDEN>
Date: Wed, 29 Jan 2025 12:05:16 +0100
X-Gm-Features: AWEUYZmxh1hHEXb9aRMG5N7SYEhrt6ecPFOVYkTlyZ-NrAfAWB_FPhcutB2DUs0
Message-ID: <CA+q8srkNwSaojXOMvNGnBPcFW_uBiZJuwqXxuB+1hXgbW5-v4A@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000b6b0fc062cd649f3"
Received-SPF: pass client-ip=2607:f8b0:4864:20::234;
 envelope-from=nico.sarlin@HIDDEN; helo=mail-oi1-x234.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Mailman-Approved-At: Wed, 29 Jan 2025 06:15:31 -0500
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 (/)

--000000000000b6b0fc062cd649f3
Content-Type: text/plain; charset="UTF-8"

Hello,
I'm using lsp-mode with corfu on the emacs-30 branch, and I get extremely
frequent CPU hogs (CPU runs at 100% for a few seconds) while typing
code. I report this as an emacs bug because it seems to only occurs when
emacs is compiled with pgtk. If I rebuild emacs with "make bootstrap
configure=default" the bug disapears.

Here is a profiler record:
       11152  91% - corfu--post-command
       11152  91%  - corfu--exhibit
       11043  90%   - corfu--update
       10891  88%    - corfu--recompute
       10891  88%     - corfu--filter-completions
       10891  88%      - completion-all-completions
       10891  88%       - completion--nth-completion
       10891  88%        - seq-some
       10891  88%         - seq-do
       10891  88%          - mapc
       10891  88%           - #<byte-code-function AC1>
       10891  88%            - #<byte-code-function AD0>
       10891  88%             - lsp-completion-passthrough-all-completions
       10891  88%              - #<byte-code-function 4B5>
       10891  88%               - #<byte-code-function 4DE>
       10888  88%                - lsp-request-while-no-input
       10888  88%                 - sit-for
          82   0%                  + redisplay_internal (C function)
          18   0%                  + #<byte-code-function 31C>
           3   0%                + lsp--text-document-position-params
         152   1%    + redisplay
          89   0%   + posn-at-point
          20   0%   + corfu--candidates-popup
         674   5% + command-execute
         269   2% + redisplay_internal (C function)
          74   0% + #<byte-code-function 31C>
          59   0% + timer-event-handler
          25   0% + ...

Please tell me if you need more information,
Thank you for your help


In GNU Emacs 30.0.93 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.43, cairo version 1.18.2) of 2025-01-27 built on zama-laptop
Repository revision: 84595cbcc78b1ea44302f22b83a7d722940c6e49
Repository branch: emacs-30
System Description: Arch Linux

Configured using:
 'configure --with-pgtk'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
  value of $LC_MONETARY: fr_FR.UTF-8
  value of $LC_NUMERIC: fr_FR.UTF-8
  value of $LC_TIME: fr_FR.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Message

Minor modes in effect:
  editorconfig-mode: t
  global-corfu-mode: t
  corfu-mode: t
  mml-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: message-do-auto-fill
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t
  hs-minor-mode: t

Load-path shadows:
None found.

Features:
(mailalias mailclient textsec uni-scripts idna-mapping ucs-normalize
uni-confusable textsec-check ispell help-fns profiler flymake
lsp-diagnostics lsp-headerline lsp-modeline lsp-lens view lsp-zig
lsp-yang lsp-yaml lsp-xml lsp-wgsl lsp-volar lsp-vimscript lsp-vhdl
lsp-vetur lsp-verilog lsp-vala lsp-v lsp-typespec lsp-typeprof lsp-ttcn3
lsp-ts-query lsp-trunk lsp-toml lsp-tilt lsp-tex lsp-terraform
lsp-svelte lsp-steep lsp-sqls lsp-sql lsp-sorbet lsp-solidity
lsp-solargraph lsp-semgrep lsp-rust lsp-ruff lsp-ruby-syntax-tree
lsp-ruby-lsp lsp-rubocop lsp-roslyn lsp-roc lsp-rf lsp-remark lsp-racket
lsp-r lsp-qml lsp-pylsp lsp-pyls lsp-pwsh lsp-purescript lsp-pls lsp-php
lsp-perlnavigator lsp-perl lsp-openscad lsp-ocaml lsp-nushell lsp-nix
lsp-nim lsp-nginx lsp-nextflow lsp-move lsp-mojo lsp-mint lsp-meson
lsp-mdx lsp-matlab lsp-marksman lsp-markdown lsp-magik lsp-fennel
lsp-lua lsp-lisp lsp-kubernetes-helm lsp-kotlin lsp-json lsp-jq
lsp-idris lsp-haxe lsp-hack lsp-groovy lsp-graphql lsp-golangci-lint
lsp-glsl lsp-gleam lsp-gdscript lsp-fsharp lsp-futhark lsp-fortran
lsp-eslint lsp-erlang lsp-emmet lsp-elm lsp-elixir lsp-earthly
lsp-dockerfile lsp-dhall lsp-d lsp-cypher lsp-cucumber lsp-copilot
lsp-css lsp-csharp lsp-crystal lsp-credo lsp-cobol lsp-cmake lsp-clojure
lsp-clangd lsp-bufls lsp-beancount lsp-bash lsp-awk lsp-autotools
lsp-astro lsp-asm lsp-ansible lsp-angular lsp-ada lsp-actionscript
vc-git diff-mode track-changes vc-dispatcher misearch multi-isearch
shadow sort mail-extr emacsbug editorconfig editorconfig-core
editorconfig-core-handle editorconfig-fnmatch rust-utils rust-prog-mode
rust-mode rust-playpen rust-cargo rust-common rust-rustfmt rust-compile
rust-mode-autoloads corfu compat corfu-autoloads lsp-ui lsp-ui-doc
lsp-ui-imenu lsp-ui-peek lsp-ui-sideline find-func goto-addr lsp-ui-util
face-remap lsp-ui-autoloads lsp-javascript lsp-html ido lsp-icons dom
lsp-go lsp-completion lsp-semantic-tokens lsp-mode comp comp-cstr
lsp-protocol xref tree-widget spinner markdown-mode lv imenu ht
filenotify f ewoc lsp-mode-autoloads s f-autoloads s-autoloads inline
dash ht-autoloads info dash-autoloads spinner-autoloads pcase color
thingatpt noutline outline markdown-mode-autoloads easy-mmode warnings
lv-autoloads loaddefs-gen lisp-mnt radix-tree tar-mode arc-mode
archive-mode cus-edit pp cus-start cus-load wid-edit mm-archive message
sendmail yank-media dired dired-loaddefs rfc822 mml mml-sec epa derived
gnus-util time-date mailabbrev gmm-utils mailheader mm-decode mm-bodies
mm-encode mail-utils gnutls network-stream url-cache url-http url-auth
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw
nsm puny compile text-property-search comint ansi-osc ansi-color ring
comp-run comp-common rx epg rfc6068 epg-config use-package-ensure
project finder-inf package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source eieio
eieio-core icons password-cache json subr-x map byte-opt url-vars
cl-macs gv cl-extra help-mode cl-seq use-package-core cl-loaddefs cl-lib
bytecomp byte-compile rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/pgtk-win pgtk-win term/common-win touch-screen pgtk-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
lcms2 multi-tty move-toolbar make-network-process native-compile emacs)

Memory information:
((conses 16 1165555 834435) (symbols 48 39223 34) (strings 32 289158 102434)
 (string-bytes 1 6818416) (vectors 16 137350) (vector-slots 8 1772485
595550)
 (floats 8 631 1411) (intervals 56 5673 2695) (buffers 992 36))

--000000000000b6b0fc062cd649f3
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Hello,<br>I&#39;m using lsp-mode with cor=
fu on the emacs-30 branch, and I get extremely<br>frequent CPU hogs (CPU ru=
ns at 100% for a few seconds) while typing<br>code. I report this as an ema=
cs bug because it seems to only occurs when<br>emacs is compiled with pgtk.=
 If I rebuild emacs with &quot;make bootstrap<br>configure=3Ddefault&quot; =
the bug disapears.<br><br>Here is a profiler record:<br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A011152 =C2=A091% - corfu--post-command<br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A011152 =C2=A091% =C2=A0- corfu--exhibit<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0110=
43 =C2=A090% =C2=A0 - corfu--update<br>=C2=A0 =C2=A0 =C2=A0 =C2=A010891 =C2=
=A088% =C2=A0 =C2=A0- corfu--recompute<br>=C2=A0 =C2=A0 =C2=A0 =C2=A010891 =
=C2=A088% =C2=A0 =C2=A0 - corfu--filter-completions<br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A010891 =C2=A088% =C2=A0 =C2=A0 =C2=A0- completion-all-completions<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A010891 =C2=A088% =C2=A0 =C2=A0 =C2=A0 - completio=
n--nth-completion<br>=C2=A0 =C2=A0 =C2=A0 =C2=A010891 =C2=A088% =C2=A0 =C2=
=A0 =C2=A0 =C2=A0- seq-some<br>=C2=A0 =C2=A0 =C2=A0 =C2=A010891 =C2=A088% =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 - seq-do<br>=C2=A0 =C2=A0 =C2=A0 =C2=A010891 =
=C2=A088% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- mapc<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A010891 =C2=A088% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 - #&lt;byte-code-f=
unction AC1&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A010891 =C2=A088% =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0- #&lt;byte-code-function AD0&gt;<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A010891 =C2=A088% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
- lsp-completion-passthrough-all-completions<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
10891 =C2=A088% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- #&lt;byte=
-code-function 4B5&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A010891 =C2=A088% =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 - #&lt;byte-code-function 4DE&gt=
;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A010888 =C2=A088% =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0- lsp-request-while-no-input<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A010888 =C2=A088% =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 - sit-for<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 82 =C2=A0 0% =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ redisplay_inte=
rnal (C function)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 18 =C2=A0 0% =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ #&lt;byte-code-fu=
nction 31C&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A03 =C2=A0 0% =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ lsp--text-document-po=
sition-params<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0152 =C2=A0 1% =C2=A0 =C2=
=A0+ redisplay<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 89 =C2=A0 0% =C2=A0 + =
posn-at-point<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 20 =C2=A0 0% =C2=A0 + c=
orfu--candidates-popup<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0674 =C2=A0 5% +=
 command-execute<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0269 =C2=A0 2% + redis=
play_internal (C function)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 74 =C2=A0 =
0% + #&lt;byte-code-function 31C&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
59 =C2=A0 0% + timer-event-handler<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 25=
 =C2=A0 0% + ...<br><br></div><div>Please tell me if you need more informat=
ion,<br></div><div dir=3D"ltr">Thank you for your help<br><br><br>In GNU Em=
acs 30.0.93 (build 1, x86_64-pc-linux-gnu, GTK+ Version<br>=C2=A03.24.43, c=
airo version 1.18.2) of 2025-01-27 built on zama-laptop<br>Repository revis=
ion: 84595cbcc78b1ea44302f22b83a7d722940c6e49<br>Repository branch: emacs-3=
0<br>System Description: Arch Linux<br><br>Configured using:<br>=C2=A0&#39;=
configure --with-pgtk&#39;<br><br>Configured features:<br>ACL CAIRO DBUS FR=
EETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG<br>LCMS2 LIBOTF LIBS=
YSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY<br>PDUMPER PGTK PNG RSVG =
SECCOMP SOUND SQLITE3 THREADS TIFF<br>TOOLKIT_SCROLL_BARS TREE_SITTER WEBP =
XIM GTK3 ZLIB<br><br>Important settings:<br>=C2=A0 value of $LC_MONETARY: f=
r_FR.UTF-8<br>=C2=A0 value of $LC_NUMERIC: fr_FR.UTF-8<br>=C2=A0 value of $=
LC_TIME: fr_FR.UTF-8<br>=C2=A0 value of $LANG: en_US.UTF-8<br>=C2=A0 locale=
-coding-system: utf-8-unix<br><br>Major mode: Message<br><br>Minor modes in=
 effect:<br>=C2=A0 editorconfig-mode: t<br>=C2=A0 global-corfu-mode: t<br>=
=C2=A0 corfu-mode: t<br>=C2=A0 mml-mode: t<br>=C2=A0 tooltip-mode: t<br>=C2=
=A0 global-eldoc-mode: t<br>=C2=A0 show-paren-mode: t<br>=C2=A0 electric-in=
dent-mode: t<br>=C2=A0 mouse-wheel-mode: t<br>=C2=A0 file-name-shadow-mode:=
 t<br>=C2=A0 global-font-lock-mode: t<br>=C2=A0 font-lock-mode: t<br>=C2=A0=
 blink-cursor-mode: t<br>=C2=A0 minibuffer-regexp-mode: t<br>=C2=A0 column-=
number-mode: t<br>=C2=A0 line-number-mode: t<br>=C2=A0 auto-fill-function: =
message-do-auto-fill<br>=C2=A0 transient-mark-mode: t<br>=C2=A0 auto-compos=
ition-mode: t<br>=C2=A0 auto-encryption-mode: t<br>=C2=A0 auto-compression-=
mode: t<br>=C2=A0 abbrev-mode: t<br>=C2=A0 hs-minor-mode: t<br><br>Load-pat=
h shadows:<br>None found.<br><br>Features:<br>(mailalias mailclient textsec=
 uni-scripts idna-mapping ucs-normalize<br>uni-confusable textsec-check isp=
ell help-fns profiler flymake<br>lsp-diagnostics lsp-headerline lsp-modelin=
e lsp-lens view lsp-zig<br>lsp-yang lsp-yaml lsp-xml lsp-wgsl lsp-volar lsp=
-vimscript lsp-vhdl<br>lsp-vetur lsp-verilog lsp-vala lsp-v lsp-typespec ls=
p-typeprof lsp-ttcn3<br>lsp-ts-query lsp-trunk lsp-toml lsp-tilt lsp-tex ls=
p-terraform<br>lsp-svelte lsp-steep lsp-sqls lsp-sql lsp-sorbet lsp-solidit=
y<br>lsp-solargraph lsp-semgrep lsp-rust lsp-ruff lsp-ruby-syntax-tree<br>l=
sp-ruby-lsp lsp-rubocop lsp-roslyn lsp-roc lsp-rf lsp-remark lsp-racket<br>=
lsp-r lsp-qml lsp-pylsp lsp-pyls lsp-pwsh lsp-purescript lsp-pls lsp-php<br=
>lsp-perlnavigator lsp-perl lsp-openscad lsp-ocaml lsp-nushell lsp-nix<br>l=
sp-nim lsp-nginx lsp-nextflow lsp-move lsp-mojo lsp-mint lsp-meson<br>lsp-m=
dx lsp-matlab lsp-marksman lsp-markdown lsp-magik lsp-fennel<br>lsp-lua lsp=
-lisp lsp-kubernetes-helm lsp-kotlin lsp-json lsp-jq<br>lsp-idris lsp-haxe =
lsp-hack lsp-groovy lsp-graphql lsp-golangci-lint<br>lsp-glsl lsp-gleam lsp=
-gdscript lsp-fsharp lsp-futhark lsp-fortran<br>lsp-eslint lsp-erlang lsp-e=
mmet lsp-elm lsp-elixir lsp-earthly<br>lsp-dockerfile lsp-dhall lsp-d lsp-c=
ypher lsp-cucumber lsp-copilot<br>lsp-css lsp-csharp lsp-crystal lsp-credo =
lsp-cobol lsp-cmake lsp-clojure<br>lsp-clangd lsp-bufls lsp-beancount lsp-b=
ash lsp-awk lsp-autotools<br>lsp-astro lsp-asm lsp-ansible lsp-angular lsp-=
ada lsp-actionscript<br>vc-git diff-mode track-changes vc-dispatcher misear=
ch multi-isearch<br>shadow sort mail-extr emacsbug editorconfig editorconfi=
g-core<br>editorconfig-core-handle editorconfig-fnmatch rust-utils rust-pro=
g-mode<br>rust-mode rust-playpen rust-cargo rust-common rust-rustfmt rust-c=
ompile<br>rust-mode-autoloads corfu compat corfu-autoloads lsp-ui lsp-ui-do=
c<br>lsp-ui-imenu lsp-ui-peek lsp-ui-sideline find-func goto-addr lsp-ui-ut=
il<br>face-remap lsp-ui-autoloads lsp-javascript lsp-html ido lsp-icons dom=
<br>lsp-go lsp-completion lsp-semantic-tokens lsp-mode comp comp-cstr<br>ls=
p-protocol xref tree-widget spinner markdown-mode lv imenu ht<br>filenotify=
 f ewoc lsp-mode-autoloads s f-autoloads s-autoloads inline<br>dash ht-auto=
loads info dash-autoloads spinner-autoloads pcase color<br>thingatpt noutli=
ne outline markdown-mode-autoloads easy-mmode warnings<br>lv-autoloads load=
defs-gen lisp-mnt radix-tree tar-mode arc-mode<br>archive-mode cus-edit pp =
cus-start cus-load wid-edit mm-archive message<br>sendmail yank-media dired=
 dired-loaddefs rfc822 mml mml-sec epa derived<br>gnus-util time-date maila=
bbrev gmm-utils mailheader mm-decode mm-bodies<br>mm-encode mail-utils gnut=
ls network-stream url-cache url-http url-auth<br>mail-parse rfc2231 rfc2047=
 rfc2045 mm-util ietf-drums mail-prsvr url-gw<br>nsm puny compile text-prop=
erty-search comint ansi-osc ansi-color ring<br>comp-run comp-common rx epg =
rfc6068 epg-config use-package-ensure<br>project finder-inf package browse-=
url url url-proxy url-privacy<br>url-expand url-methods url-history url-coo=
kie generate-lisp-file<br>url-domsuf url-util mailcap url-handlers url-pars=
e auth-source eieio<br>eieio-core icons password-cache json subr-x map byte=
-opt url-vars<br>cl-macs gv cl-extra help-mode cl-seq use-package-core cl-l=
oaddefs cl-lib<br>bytecomp byte-compile rmc iso-transl tooltip cconv eldoc =
paren electric<br>uniquify ediff-hook vc-hooks lisp-float-type elisp-mode m=
wheel<br>term/pgtk-win pgtk-win term/common-win touch-screen pgtk-dnd tool-=
bar<br>dnd fontset image regexp-opt fringe tabulated-list replace newcommen=
t<br>text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshad=
ow<br>isearch easymenu timer select scroll-bar mouse jit-lock font-lock syn=
tax<br>font-core term/tty-colors frame minibuffer nadvice seq simple cl-gen=
eric<br>indonesian philippine cham georgian utf-8-lang misc-lang vietnamese=
<br>tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek=
<br>romanian slovak czech european ethiopic indian cyrillic chinese<br>comp=
osite emoji-zwj charscript charprop case-table epa-hook<br>jka-cmpr-hook he=
lp abbrev obarray oclosure cl-preloaded button loaddefs<br>theme-loaddefs f=
aces cus-face macroexp files window text-properties<br>overlay sha1 md5 bas=
e64 format env code-pages mule custom widget keymap<br>hashtable-print-read=
able backquote threads dbusbind inotify<br>dynamic-setting system-font-sett=
ing font-render-setting cairo gtk pgtk<br>lcms2 multi-tty move-toolbar make=
-network-process native-compile emacs)<br><br>Memory information:<br>((cons=
es 16 1165555 834435) (symbols 48 39223 34) (strings 32 289158 102434)<br>=
=C2=A0(string-bytes 1 6818416) (vectors 16 137350) (vector-slots 8 1772485 =
595550)<br>=C2=A0(floats 8 631 1411) (intervals 56 5673 2695) (buffers 992 =
36))<br></div></div>

--000000000000b6b0fc062cd649f3--




Message sent:


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: Nicolas Sarlin <nico.sarlin@HIDDEN>
Subject: bug#75922: Acknowledgement (CPU hogs with pgtk)
Message-ID: <handler.75922.B.173814933427960.ack <at> debbugs.gnu.org>
References: <CA+q8srkNwSaojXOMvNGnBPcFW_uBiZJuwqXxuB+1hXgbW5-v4A@HIDDEN>
X-Gnu-PR-Message: ack 75922
X-Gnu-PR-Package: emacs
Reply-To: 75922 <at> debbugs.gnu.org
Date: Wed, 29 Jan 2025 11:16:02 +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 75922 <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
75922: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D75922
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75922: CPU hogs with pgtk
Resent-From: Pip Cet <pipcet@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 29 Jan 2025 12:42:02 +0000
Resent-Message-ID: <handler.75922.B75922.17381544921313 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75922
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Nicolas Sarlin <nico.sarlin@HIDDEN>
Cc: 75922 <at> debbugs.gnu.org
Received: via spool by 75922-submit <at> debbugs.gnu.org id=B75922.17381544921313
          (code B ref 75922); Wed, 29 Jan 2025 12:42:02 +0000
Received: (at 75922) by debbugs.gnu.org; 29 Jan 2025 12:41:32 +0000
Received: from localhost ([127.0.0.1]:40225 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1td7Nr-0000L5-SF
	for submit <at> debbugs.gnu.org; Wed, 29 Jan 2025 07:41:32 -0500
Received: from mail-10630.protonmail.ch ([79.135.106.30]:33683)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <pipcet@HIDDEN>)
 id 1td7Nn-0000Ke-UT
 for 75922 <at> debbugs.gnu.org; Wed, 29 Jan 2025 07:41:29 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
 s=protonmail3; t=1738154478; x=1738413678;
 bh=mJwyEC/LfHDDJF70NV0ABgaLWU+A4IPzcD5D1bVQgqo=;
 h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:
 Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:
 Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post;
 b=lL6vHHgqQs8aKQP4wI2pVebGmVqaFEOIx8qUAvd73WMd962PkkkP1RMeBl09mr8tT
 /53I2hryoVefU9zHRf7BciUr6w4H3CT8oKjNJarK35gqmDMQLMPTGnX/qbkB3/c6uT
 fTUKSNuf9EXj2JakeF6Lto79TQmF1rj4iRYDNE3QqUy+Ligyo/LbidlKN4C8/zHRJd
 mN3SccCU7dsrtuGAmCPhOtoecm++dMh160oTbuwh3Uz4J+V7/6LPBHpcvfafV5wHxf
 cQc5iT7DxnCYyUzqeCOOz0yUldaxRAm9/O/K+EjOaRrcRrlxY/8LD06uqtsB9JS1ko
 zxsSYGZrLx6Vg==
Date: Wed, 29 Jan 2025 12:41:14 +0000
From: Pip Cet <pipcet@HIDDEN>
Message-ID: <87o6zpokrw.fsf@HIDDEN>
In-Reply-To: <CA+q8srkNwSaojXOMvNGnBPcFW_uBiZJuwqXxuB+1hXgbW5-v4A@HIDDEN>
References: <CA+q8srkNwSaojXOMvNGnBPcFW_uBiZJuwqXxuB+1hXgbW5-v4A@HIDDEN>
Feedback-ID: 112775352:user:proton
X-Pm-Message-ID: c35ff210b2ac8195ed4f766a1087cd563e97855c
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 (-)

"Nicolas Sarlin" <nico.sarlin@HIDDEN> writes:

Thanks for the report! Debug suggestions below, but if you cannot or
would prefer not to any or all of that, that's perfectly okay, too!

> I'm using lsp-mode with corfu on the emacs-30 branch, and I get extremely
> frequent CPU hogs (CPU runs at 100% for a few seconds) while typing
> code.

So this happens on the pgtk branch, but behavior on the master branch is
not noticeably slower than you'd expect?

> I report this as an emacs bug because it seems to only occurs when
> emacs is compiled with pgtk.

Are you running this on a Wayland setup, or on X (ignoring the popup)?

> If I rebuild emacs with "make bootstrap configure=3Ddefault" the bug
> disapears.

Entirely?

> Here is a profiler record:
>        11152  91% - corfu--post-command
>        11152  91%  - corfu--exhibit
>        11043  90%   - corfu--update
>        10891  88%    - corfu--recompute
>        10891  88%     - corfu--filter-completions
>        10891  88%      - completion-all-completions
>        10891  88%       - completion--nth-completion
>        10891  88%        - seq-some
>        10891  88%         - seq-do
>        10891  88%          - mapc
>        10891  88%           - #<byte-code-function AC1>
>        10891  88%            - #<byte-code-function AD0>
>        10891  88%             - lsp-completion-passthrough-all-completion=
s
>        10891  88%              - #<byte-code-function 4B5>
>        10891  88%               - #<byte-code-function 4DE>
>        10888  88%                - lsp-request-while-no-input
>        10888  88%                 - sit-for
>           82   0%                  + redisplay_internal (C function)
>           18   0%                  + #<byte-code-function 31C>
>            3   0%                + lsp--text-document-position-params
>          152   1%    + redisplay
>           89   0%   + posn-at-point
>           20   0%   + corfu--candidates-popup
>          674   5% + command-execute
>          269   2% + redisplay_internal (C function)
>           74   0% + #<byte-code-function 31C>
>           59   0% + timer-event-handler
>           25   0% + ...
>
> Please tell me if you need more information,

While a Lisp profile is always a good thing to have, I suspect a C
profile is more useful in this case.  Can you run

perf record -e instructions,cycles ./src/emacs -Q

then find a problematic workflow and wait for the problem to occur
(ideally, this will happen so often as to dominate the CPU trace), then
quit emacs in the ordinary fashion.  After that

perf report

will produce a basic output C profile.  It's both very long and somewhat
hard to read, but I think posting it to a bug number email should be
okay.  If you do this, please save these files for this specific run
somewhere:

./src/emacs
./src/emacs.pdmp
./perf.data
any coredumps you might have had

This will allow us to investigate the situation further if the function
names aren't enough to find the culprits.

Please also attempt to find the precise version of "corfu", as well as
any other packages that might seem like they're involved.

Thanks!
Pip





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75922: CPU hogs with pgtk
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: Wed, 29 Jan 2025 13:08:02 +0000
Resent-Message-ID: <handler.75922.B75922.17381560225740 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75922
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Nicolas Sarlin <nico.sarlin@HIDDEN>
Cc: 75922 <at> debbugs.gnu.org
Received: via spool by 75922-submit <at> debbugs.gnu.org id=B75922.17381560225740
          (code B ref 75922); Wed, 29 Jan 2025 13:08:02 +0000
Received: (at 75922) by debbugs.gnu.org; 29 Jan 2025 13:07:02 +0000
Received: from localhost ([127.0.0.1]:40271 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1td7mX-0001UQ-IA
	for submit <at> debbugs.gnu.org; Wed, 29 Jan 2025 08:07:02 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:36604)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1td7mS-0001Tw-Td
 for 75922 <at> debbugs.gnu.org; Wed, 29 Jan 2025 08:06:59 -0500
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 1td7mN-0001fu-Ik; Wed, 29 Jan 2025 08:06:51 -0500
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=ldh//X2r84qzwiFF3YLgq1unuiRTMcXJKgX/CU5huPc=; b=V3cUJ1zRkb2N
 eeQZgpQ+mm5fZidbmohOmbs6PlN09xLV7V5CF38AUJa+W536xWdfok8h1SGh5ybRW/91tyAuo7OGz
 0RvzSas7ueuWBMj+FCK2X1Hlzt2hqKow9Ch1TP/dTzf3vALbnq0yhl/OMpCLKlIDDd3H4ohPvtijG
 ShXruiEujb6NVfngr7RuRQpw4xCx+wkejz6MAyxx+ag6D9XyvrlkO5BR1+WoRUBQvjzr+6pmbgBQB
 o9C8iecUJZlYiBbeZ46Ck57Doc7zRYqoFF+L/VhEr2oMIDhPXLdo1g09hE5ZuTdM936zUaw/I/YxX
 Guz3ibpZI5EgnvLzMkKpwg==;
Date: Wed, 29 Jan 2025 15:06:50 +0200
Message-Id: <86plk5n505.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <CA+q8srkNwSaojXOMvNGnBPcFW_uBiZJuwqXxuB+1hXgbW5-v4A@HIDDEN>
 (message from Nicolas Sarlin on Wed, 29 Jan 2025 12:05:16 +0100)
References: <CA+q8srkNwSaojXOMvNGnBPcFW_uBiZJuwqXxuB+1hXgbW5-v4A@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 (---)

> From: Nicolas Sarlin <nico.sarlin@HIDDEN>
> Date: Wed, 29 Jan 2025 12:05:16 +0100
> 
> I'm using lsp-mode with corfu on the emacs-30 branch, and I get extremely
> frequent CPU hogs (CPU runs at 100% for a few seconds) while typing
> code. I report this as an emacs bug because it seems to only occurs when
> emacs is compiled with pgtk. If I rebuild emacs with "make bootstrap
> configure=default" the bug disapears.
> 
> Here is a profiler record:
>        11152  91% - corfu--post-command
>        11152  91%  - corfu--exhibit
>        11043  90%   - corfu--update
>        10891  88%    - corfu--recompute
>        10891  88%     - corfu--filter-completions
>        10891  88%      - completion-all-completions
>        10891  88%       - completion--nth-completion
>        10891  88%        - seq-some
>        10891  88%         - seq-do
>        10891  88%          - mapc
>        10891  88%           - #<byte-code-function AC1>
>        10891  88%            - #<byte-code-function AD0>
>        10891  88%             - lsp-completion-passthrough-all-completions
>        10891  88%              - #<byte-code-function 4B5>
>        10891  88%               - #<byte-code-function 4DE>
>        10888  88%                - lsp-request-while-no-input
>        10888  88%                 - sit-for

The profile says most of the time is spent in sit-for called from
lsp-request-while-no-input.  First, sit-for is not supposed to consume
CPU, because it's a waiting function.  Are you sure this profile was
taken when Emacs was hogging CPU?

And second, lsp-mode is not part of Emacs, so if indeed the above is a
profile representative of high CPU load, I suggest to report this to
the developers of lsp-mode first, even though the problem appears only
in the PGTK build.

Thanks.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75922: CPU hogs with pgtk
Resent-From: Nicolas Sarlin <nico.sarlin@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 29 Jan 2025 16:36:02 +0000
Resent-Message-ID: <handler.75922.B75922.173816853714882 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75922
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Pip Cet <pipcet@HIDDEN>
Cc: 75922 <at> debbugs.gnu.org
Received: via spool by 75922-submit <at> debbugs.gnu.org id=B75922.173816853714882
          (code B ref 75922); Wed, 29 Jan 2025 16:36:02 +0000
Received: (at 75922) by debbugs.gnu.org; 29 Jan 2025 16:35:37 +0000
Received: from localhost ([127.0.0.1]:42744 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tdB2O-0003rw-4c
	for submit <at> debbugs.gnu.org; Wed, 29 Jan 2025 11:35:37 -0500
Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]:55536)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <nico.sarlin@HIDDEN>)
 id 1td9zL-0000Vo-5s
 for 75922 <at> debbugs.gnu.org; Wed, 29 Jan 2025 10:28:24 -0500
Received: by mail-oi1-x22c.google.com with SMTP id
 5614622812f47-3eb87127854so1672146b6e.2
 for <75922 <at> debbugs.gnu.org>; Wed, 29 Jan 2025 07:28:23 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1738164497; x=1738769297; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=0MIGxOUoQmFgSbjtotsLpnM4Dr2L/Z3reDfz3ksoqCg=;
 b=hgkfK6+4vwYIviaGVEihvjMrE1fip/A8p6n72YxZn3H57vxUUqIKtN81ik3QEcIrlY
 so/ahevH+/rSrBMU/n8yGM6YK6Ht2CXeoP5fMGPTt944CAMv65GGM8fhUOiNYVg8pvkq
 z3TQXe4X0QmpZBrv2QiYgfOoQpU40DoEJop/URk498/Ys0C89n4HjT21Dl/PXEZ57h5e
 +jzNVMHQjMNZQRww+Axwhk5qV7Kn3Ly8OizgNb2VwXq5b665sVfaPxX0ZB/ninhh37Ec
 WIgq5FfAOVgNcX8Q3b9pdElorlFiATLTq4T15DKN2OPk7BZH0I/omHgLVUvuhxVSZSYg
 Zt/Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1738164497; x=1738769297;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=0MIGxOUoQmFgSbjtotsLpnM4Dr2L/Z3reDfz3ksoqCg=;
 b=u9pm7uy6DA6edV569UCUelwZWh0eBeicfKmSXOKy1cPmwLrz/do/i2tlWnc40SmPuh
 EfuqgezSKNIAr3uxDvgWtu9SDQTddmVvoJNb9hwTQ8n9VdXPG7Bg1FNICLSBpxh3E39i
 SgcRyHQ+gd30Sd57EX2TkJeLDoALxXRa6uLH51VMtXW582l2lqjtz7VJAiycwT5fABic
 g0N/ZUA7Uxb+K5t5H2O37RQqBqeD0kbKpp2z3hSV7K6W3hfi1HOmJyIS52ClS0q3lTyh
 eNi8qH6xY1z+5gmM2478yuQqaT1LQVwkXtKwcs9bs6kRL8Q5PgCsJ9cTI+Y+BKCq+CL0
 jKFg==
X-Gm-Message-State: AOJu0YwWtEUHffaEUVBTaggRNx4dA9Z8ePEi+OzyQubVKQSW77raH7BA
 Q6gjQujkdS1nLQqVyCd9kWgbloc90KcETm6A2HMU5SCGTyjicJ1i1uPAxzO+SZ8V/Zcx4ceBE1g
 zxJQMM373ohcZ6S6TbMytyhzlb14=
X-Gm-Gg: ASbGncuWQxTZdoswGw7EmaiJi4Ta9NEgTXNjXS5GPIHo9Ix2SDAvrAWybUPBDPGG8eL
 1P6TDHLroZkYBC8NG+sm4Gg9D2Uzj/AmUJZuEcSe+IHdXvMyczQyOMbRV5RcoqqRtI/J5xz4zcA
 ==
X-Google-Smtp-Source: AGHT+IGU4N/0MGY16MYOsOJldTwazflgPVi/JhF3OklC+sBgF91FxbpEu0bXDGm8iIS0IGsptQ6PYOR6xWnwiWovKy0=
X-Received: by 2002:a05:6808:448a:b0:3e6:1ea5:6b30 with SMTP id
 5614622812f47-3f323b4acf6mr2008575b6e.24.1738164496971; Wed, 29 Jan 2025
 07:28:16 -0800 (PST)
MIME-Version: 1.0
References: <CA+q8srkNwSaojXOMvNGnBPcFW_uBiZJuwqXxuB+1hXgbW5-v4A@HIDDEN>
 <87o6zpokrw.fsf@HIDDEN>
In-Reply-To: <87o6zpokrw.fsf@HIDDEN>
From: Nicolas Sarlin <nico.sarlin@HIDDEN>
Date: Wed, 29 Jan 2025 16:28:01 +0100
X-Gm-Features: AWEUYZlfmQyallKHfzzRqqIZ8OJ4zlBe4AeTrbzA44yJwuYSvQJ5i9EDBO8T5fA
Message-ID: <CA+q8sr=j1iJ=gSgSO5n5vZ94FhdG9G7KhXsSYmk+OYz45MxCBA@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Mailman-Approved-At: Wed, 29 Jan 2025 11:35:34 -0500
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 (-)

Thanks for your answer!

On Wed, 29 Jan 2025 at 13:41, Pip Cet <pipcet@HIDDEN> wrote:
>
> "Nicolas Sarlin" <nico.sarlin@HIDDEN> writes:
>
> Thanks for the report! Debug suggestions below, but if you cannot or
> would prefer not to any or all of that, that's perfectly okay, too!
>
> > I'm using lsp-mode with corfu on the emacs-30 branch, and I get extreme=
ly
> > frequent CPU hogs (CPU runs at 100% for a few seconds) while typing
> > code.
>
> So this happens on the pgtk branch, but behavior on the master branch is
> not noticeably slower than you'd expect?

This happens on the emacs-30 branch with configure=3D--with-pgtk

> > I report this as an emacs bug because it seems to only occurs when
> > emacs is compiled with pgtk.
>
> Are you running this on a Wayland setup, or on X (ignoring the popup)?

I am running this on Wayland

>
>
> > If I rebuild emacs with "make bootstrap configure=3Ddefault" the bug
> > disapears.
>
> Entirely?

Yes, I see no slowdown at all without pgtk.
>
>
> > Here is a profiler record:
> >        11152  91% - corfu--post-command
> >        11152  91%  - corfu--exhibit
> >        11043  90%   - corfu--update
> >        10891  88%    - corfu--recompute
> >        10891  88%     - corfu--filter-completions
> >        10891  88%      - completion-all-completions
> >        10891  88%       - completion--nth-completion
> >        10891  88%        - seq-some
> >        10891  88%         - seq-do
> >        10891  88%          - mapc
> >        10891  88%           - #<byte-code-function AC1>
> >        10891  88%            - #<byte-code-function AD0>
> >        10891  88%             - lsp-completion-passthrough-all-completi=
ons
> >        10891  88%              - #<byte-code-function 4B5>
> >        10891  88%               - #<byte-code-function 4DE>
> >        10888  88%                - lsp-request-while-no-input
> >        10888  88%                 - sit-for
> >           82   0%                  + redisplay_internal (C function)
> >           18   0%                  + #<byte-code-function 31C>
> >            3   0%                + lsp--text-document-position-params
> >          152   1%    + redisplay
> >           89   0%   + posn-at-point
> >           20   0%   + corfu--candidates-popup
> >          674   5% + command-execute
> >          269   2% + redisplay_internal (C function)
> >           74   0% + #<byte-code-function 31C>
> >           59   0% + timer-event-handler
> >           25   0% + ...
> >
> > Please tell me if you need more information,
>
> While a Lisp profile is always a good thing to have, I suspect a C
> profile is more useful in this case.  Can you run
>
> perf record -e instructions,cycles ./src/emacs -Q
>
> then find a problematic workflow and wait for the problem to occur
> (ideally, this will happen so often as to dominate the CPU trace), then
> quit emacs in the ordinary fashion.  After that
>
> perf report
>
> will produce a basic output C profile.  It's both very long and somewhat
> hard to read, but I think posting it to a bug number email should be
> okay.  If you do this, please save these files for this specific run
> somewhere:
>
> ./src/emacs
> ./src/emacs.pdmp
> ./perf.data
> any coredumps you might have had
>
> This will allow us to investigate the situation further if the function
> names aren't enough to find the culprits.

Thanks, here is a partial output of perf report, tell me if you need
more (events > 1%):

=3D=3D=3D=3D
Samples: 1K of event 'cpu_atom/instructions/u', Event count (approx.):
1304155293
 10,41%  emacs    emacs                           [.]
find_cache_boundary

                                        =E2=97=86
   5,90%  emacs    emacs                           [.]
lookup_char_property

                                        =E2=96=92
   4,71%  emacs    libpixman-1.so.0.44.2           [.]
0x000000000006f4c3

                                        =E2=96=92
   3,33%  emacs    libpixman-1.so.0.44.2           [.]
0x000000000006f4d7

                                        =E2=96=92
   3,01%  emacs    libpixman-1.so.0.44.2           [.]
0x00000000000733a2

                                        =E2=96=92
   2,84%  emacs    libpixman-1.so.0.44.2           [.]
0x00000000000733d5

                                        =E2=96=92
   2,61%  emacs    libpixman-1.so.0.44.2           [.]
0x000000000006f4df

                                        =E2=96=92
   2,57%  emacs    emacs                           [.] find_newline


                        =E2=96=92
   2,20%  emacs    libpixman-1.so.0.44.2           [.]
0x00000000000733b8

                                        =E2=96=92
   1,81%  emacs    libpixman-1.so.0.44.2           [.]
0x00000000000733af

                                        =E2=96=92
   1,75%  emacs    emacs                           [.] read_char


                        =E2=96=92
   1,72%  emacs    emacs                           [.]
itree_iter_next_in_subtree

                                        =E2=96=92
   1,65%  emacs    libpixman-1.so.0.44.2           [.]
0x00000000000733e1

                                        =E2=96=92
   1,62%  emacs    libpixman-1.so.0.44.2           [.]
0x000000000006f4cf

                                        =E2=96=92
   1,59%  emacs    libpixman-1.so.0.44.2           [.]
0x00000000000733cf

                                        =E2=96=92
   1,56%  emacs    libpixman-1.so.0.44.2           [.]
0x00000000000733c5

                                        =E2=96=92
   1,56%  emacs    emacs                           [.]
re_match_2_internal

                                        =E2=96=92
   1,47%  emacs    libpixman-1.so.0.44.2           [.]
0x00000000000733aa

                                        =E2=96=92
   1,42%  emacs    emacs                           [.] find_interval


                        =E2=96=92
   1,34%  emacs    [vdso]                          [.]
__vdso_clock_gettime

                                        =E2=96=92
   1,21%  emacs    libpixman-1.so.0.44.2           [.]
0x00000000000733b6

                                        =E2=96=92
   1,19%  emacs    emacs                           [.] Fassq


                        =E2=96=92
   1,18%  emacs    libpixman-1.so.0.44.2           [.]
0x00000000000733e4

                                        =E2=96=92
   1,14%  emacs    libpixman-1.so.0.44.2           [.]
0x00000000000733d9

                                        =E2=96=92
   1,10%  emacs    emacs                           [.]
gui_produce_glyphs

                                        =E2=96=92
   1,05%  emacs    emacs                           [.]
bidi_resolve_explicit

=3D=3D=3D=3D
Samples: 133K of event 'cpu_core/instructions/u', Event count
(approx.): 186403198903
  21,55%  emacs    [vdso]                                [.]
__vdso_clock_gettime
  20,07%  emacs    [unknown]                             [k] 0xffffffff9e20=
0080
  11,55%  emacs    emacs                                 [.] read_char
   4,31%  emacs    emacs                                 [.] restore_getcjm=
p
   2,87%  emacs    libpixman-1.so.0.44.2                 [.] 0x000000000007=
33a2
   2,47%  emacs    emacs                                 [.]
quit_throw_to_read_char
   2,16%  emacs    emacs                                 [.] some_mouse_mov=
ed
   1,94%  emacs    libc.so.6                             [.] siglongjmp
   1,89%  emacs    libc.so.6                             [.] pthread_sigmas=
k
   1,75%  emacs    emacs                                 [.] unbind_to
   1,49%  emacs    emacs                                 [.] EQ
   1,33%  emacs    libc.so.6                             [.] 0x000000000009=
25c6
   1,32%  emacs    emacs                                 [.] kbd_on_hold_p
   1,25%  emacs    libc.so.6                             [.] 0x000000000009=
25a5
   1,19%  emacs    emacs                                 [.] _longjmp@plt
   1,18%  emacs    libc.so.6                             [.] 0x000000000009=
2616
   1,11%  emacs    emacs                                 [.]
record_unwind_protect_ptr
   1,10%  emacs    libpixman-1.so.0.44.2                 [.] 0x000000000007=
33b8
   1,08%  emacs    libc.so.6                             [.] 0x000000000003=
cfaf
   1,00%  emacs    emacs                                 [.] pthread_sigmas=
k@plt

=3D=3D=3D=3D
Samples: 1K of event 'cpu_atom/cycles/u', Event count (approx.): 1083537627
 22,42%  emacs    libpixman-1.so.0.44.2         [.] 0x000000000006f4c3


                       =E2=97=86
  13,33%  emacs    libpixman-1.so.0.44.2         [.]
0x000000000006f4d7

                                          =E2=96=92
   9,30%  emacs    libpixman-1.so.0.44.2         [.]
0x000000000006f4df

                                          =E2=96=92
   4,77%  emacs    emacs                         [.]
find_cache_boundary

                                          =E2=96=92
   3,84%  emacs    libpixman-1.so.0.44.2         [.]
0x000000000006f4cf

                                          =E2=96=92
   2,95%  emacs    libpixman-1.so.0.44.2         [.]
0x00000000000733a2

                                          =E2=96=92
   2,34%  emacs    emacs                         [.]
lookup_char_property

                                          =E2=96=92
   1,51%  emacs    libpixman-1.so.0.44.2         [.]
0x000000000006f4e3

                                          =E2=96=92
   1,28%  emacs    libpixman-1.so.0.44.2         [.]
0x00000000000733b8

                                          =E2=96=92
   1,23%  emacs    libpixman-1.so.0.44.2         [.]
0x000000000006f4d3

=3D=3D=3D=3D
Samples: 140K of event 'cpu_core/cycles/u', Event count (approx.): 79660130=
854
  16,86%  emacs    [vdso]                                [.]
__vdso_clock_gettime
  13,66%  emacs    [unknown]                             [k] 0xffffffff9e20=
0080
  12,32%  emacs    emacs                                 [.] read_char
   6,88%  emacs    emacs                                 [.] unbind_to
   6,41%  emacs    libpixman-1.so.0.44.2                 [.] 0x000000000007=
33a2
   5,66%  emacs    libc.so.6                             [.] pthread_sigmas=
k
   4,58%  emacs    emacs                                 [.] restore_getcjm=
p
   3,73%  emacs    libpixman-1.so.0.44.2                 [.] 0x000000000006=
f4c3
   2,64%  emacs    libpixman-1.so.0.44.2                 [.] 0x000000000006=
f4db
   2,22%  emacs    emacs                                 [.]
quit_throw_to_read_char
   1,90%  emacs    libpixman-1.so.0.44.2                 [.] 0x000000000006=
f4e3
   1,24%  emacs    emacs                                 [.] some_mouse_mov=
ed
   1,19%  emacs    libpixman-1.so.0.44.2                 [.] 0x000000000006=
f4cb
   1,08%  emacs    emacs                                 [.]
record_unwind_protect_ptr
   1,05%  emacs    emacs                                 [.] current_timesp=
ec


>
> Please also attempt to find the precise version of "corfu", as well as
> any other packages that might seem like they're involved.

I am using corfu 1.7 from melpa-stable, and lsp-mode 20250129.601 from melp=
a

>
>
> Thanks!
> Pip
>




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75922: CPU hogs with pgtk
Resent-From: Nicolas Sarlin <nico.sarlin@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 29 Jan 2025 16:36:02 +0000
Resent-Message-ID: <handler.75922.B75922.173816853814888 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75922
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 75922 <at> debbugs.gnu.org
Received: via spool by 75922-submit <at> debbugs.gnu.org id=B75922.173816853814888
          (code B ref 75922); Wed, 29 Jan 2025 16:36:02 +0000
Received: (at 75922) by debbugs.gnu.org; 29 Jan 2025 16:35:38 +0000
Received: from localhost ([127.0.0.1]:42746 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tdB2P-0003s0-Dd
	for submit <at> debbugs.gnu.org; Wed, 29 Jan 2025 11:35:37 -0500
Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]:58708)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <nico.sarlin@HIDDEN>)
 id 1tdAWT-00028M-3T
 for 75922 <at> debbugs.gnu.org; Wed, 29 Jan 2025 11:02:38 -0500
Received: by mail-oa1-x32.google.com with SMTP id
 586e51a60fabf-29fad34bb62so3590364fac.1
 for <75922 <at> debbugs.gnu.org>; Wed, 29 Jan 2025 08:02:37 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1738166551; x=1738771351; 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=TtspvxofkYo39maDhKckh9uTWbBjQSk6JZgCE5c4hT4=;
 b=MvvSTSXfVf/B4Cq12KIrlpOiBazZcMkwI4F8g9Qc2TjHcVSEXY2NV33qMfpCJts/70
 Dd5sUnbEmqaeq+oM1JVkAFvfKdqCJI8L8QSa8SOXJNd2jHxPS8K8vkPBw7ReGdS/dzIz
 kyXfvg4HGS/q5XmXrzT+vYR2ityiL9WkKF89571Zx0klvqEmZ3d8YqyF4nIyf9jTj5AP
 4f7mIZvqTn2YYyxfAHzLYtHw7l0DLLVeJEXeTsUAFt+brLsW1/I9P0/MfRS9nx7kmyFf
 V2Qwy1XHzLw5sDmeeXbz2lLJtLqaEdJ5tPk6T4sYPlSTyMoLXP3tz+RmA4RcQWA07llV
 nOMg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1738166551; x=1738771351;
 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=TtspvxofkYo39maDhKckh9uTWbBjQSk6JZgCE5c4hT4=;
 b=kcYkSnrwyn0e9upbohmkVZSJ7rsV+WgHBWwAgrdm2eZb4xJnndaumn5r9tQleMlPDR
 bF6Td237OtKDtEPoQkLMvHuH7zBp22cFNStzdET0WTzCF/MMPpaG/lzEkqCXpOMFArvn
 1qHu/laBfo2VXhXzwyVDj0utMSlz0ls8e1YJDdfApcSdKYv+geovAgd3dxHrC187mRm+
 g5vpItX0SryozhTHupgtY2sLQL+BumQOwaaFmQIZY67VNbBawGSL1kRL4lMwp7XeUX0Y
 eiwQlDe70nDmqfDHoOh4lkUkhPuLZOEDEcyTwJNaxhcVLtJ4/ysZrHyGeCvlp77iYdhl
 W/wQ==
X-Gm-Message-State: AOJu0YyILwcYWYeq8c7GO0e3lsZYdIdrMhtuS2dLaO5iaO13GdGFwKSJ
 p/J939ibfg28n7neaNdp5Luxe8k9Wg0VXqZ7D7kOUy4nbPtesQkF7WLhDm+nbtURiGZdq/Rb9vC
 1g0xxozyyi3FuP3vEiAaFI6QoJhs=
X-Gm-Gg: ASbGncuZ1W0Uy4vOCbnhBhtcHw8FDFc8HGMPIpjWKPElWnMsdcmM5j2mGdAJyJOBr2/
 Fg4A4oXLKUEKnfBQA6208IAtRQwsfHfA6fwG/BCl1TvzZi0lz9/B12IijzMKfgRsIG7ihsALtxQ
 ==
X-Google-Smtp-Source: AGHT+IGrNW3SgNjkQKko0YYCtCsr4LRlyqRI5eYKxphva+v5ppkbyPngce1/oQJSU1h/5Q4XtG+yeiNfCukBFq87l4Y=
X-Received: by 2002:a05:6870:ae97:b0:29d:c6c9:c384 with SMTP id
 586e51a60fabf-2b32f0c49b5mr1937303fac.22.1738166551282; Wed, 29 Jan 2025
 08:02:31 -0800 (PST)
MIME-Version: 1.0
References: <CA+q8srkNwSaojXOMvNGnBPcFW_uBiZJuwqXxuB+1hXgbW5-v4A@HIDDEN>
 <86plk5n505.fsf@HIDDEN>
In-Reply-To: <86plk5n505.fsf@HIDDEN>
From: Nicolas Sarlin <nico.sarlin@HIDDEN>
Date: Wed, 29 Jan 2025 17:02:16 +0100
X-Gm-Features: AWEUYZlqFplGp-nq_abLUB_r0WPzmupgWs0z5xTEV5eKcaoVRNwbYs360J2L6fY
Message-ID: <CA+q8srmhNQX5CDiJE3AbnvWBOWzGNtcYKp3i2oqfTxgMUirMiA@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Mailman-Approved-At: Wed, 29 Jan 2025 11:35:34 -0500
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, 29 Jan 2025 at 14:06, Eli Zaretskii <eliz@HIDDEN> wrote:
>
> > From: Nicolas Sarlin <nico.sarlin@HIDDEN>
> > Date: Wed, 29 Jan 2025 12:05:16 +0100
> >
> > I'm using lsp-mode with corfu on the emacs-30 branch, and I get extremely
> > frequent CPU hogs (CPU runs at 100% for a few seconds) while typing
> > code. I report this as an emacs bug because it seems to only occurs when
> > emacs is compiled with pgtk. If I rebuild emacs with "make bootstrap
> > configure=default" the bug disapears.
> >
> > Here is a profiler record:
> >        11152  91% - corfu--post-command
> >        11152  91%  - corfu--exhibit
> >        11043  90%   - corfu--update
> >        10891  88%    - corfu--recompute
> >        10891  88%     - corfu--filter-completions
> >        10891  88%      - completion-all-completions
> >        10891  88%       - completion--nth-completion
> >        10891  88%        - seq-some
> >        10891  88%         - seq-do
> >        10891  88%          - mapc
> >        10891  88%           - #<byte-code-function AC1>
> >        10891  88%            - #<byte-code-function AD0>
> >        10891  88%             - lsp-completion-passthrough-all-completions
> >        10891  88%              - #<byte-code-function 4B5>
> >        10891  88%               - #<byte-code-function 4DE>
> >        10888  88%                - lsp-request-while-no-input
> >        10888  88%                 - sit-for
>
> The profile says most of the time is spent in sit-for called from
> lsp-request-while-no-input.  First, sit-for is not supposed to consume
> CPU, because it's a waiting function.  Are you sure this profile was
> taken when Emacs was hogging CPU?
>
> And second, lsp-mode is not part of Emacs, so if indeed the above is a
> profile representative of high CPU load, I suggest to report this to
> the developers of lsp-mode first, even though the problem appears only
> in the PGTK build.
>
> Thanks.

Hi, thank you for your answer.
Yes, this profile was collected during an emacs freeze. It took me a
few second (maybe 10) after `profiler-start` to trigger the freeze,
then again a few seconds of freeze, then I ran `profiler-stop`
directly after. During the freeze I had one CPU core constantly
running at 100%.

I have seen a similar issue on lsp-mode closed so I tried to report it
here: https://github.com/emacs-lsp/lsp-mode/issues/3720
Similarly to what is reported in the lsp issue, this only occurs for
me when I mix lsp-mode, corfu and pgtk, so it's difficult to find the
exact root cause.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75922: CPU hogs with pgtk
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: Wed, 29 Jan 2025 16:36:03 +0000
Resent-Message-ID: <handler.75922.B75922.173816854914921 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75922
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Nicolas Sarlin <nico.sarlin@HIDDEN>
Cc: 75922 <at> debbugs.gnu.org
Received: via spool by 75922-submit <at> debbugs.gnu.org id=B75922.173816854914921
          (code B ref 75922); Wed, 29 Jan 2025 16:36:03 +0000
Received: (at 75922) by debbugs.gnu.org; 29 Jan 2025 16:35:49 +0000
Received: from localhost ([127.0.0.1]:42750 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tdB2b-0003sa-0O
	for submit <at> debbugs.gnu.org; Wed, 29 Jan 2025 11:35:49 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:57172)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tdB2X-0003sI-86
 for 75922 <at> debbugs.gnu.org; Wed, 29 Jan 2025 11:35:45 -0500
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 1tdB2R-0002T1-PI; Wed, 29 Jan 2025 11:35:39 -0500
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=ijOlSTMDQ3R3ql2yHb+u+Y7az74Of3kzyDCCsIQOc5w=; b=UnJZ7D2CE7NQ
 amePF2FyM745Hdor4S9VYpOWqaz8DHszPn0imkZD5sI5qmT8t8z9VBjCCufnMvvZg6YBegVi0tSfY
 nCsuax8H7Xn+QK7lCbr5nPHI2MrKEt3eK6KUGDxLo7qUjFBmPPo7aP3JmXQf9BSHD+60mG8qcICix
 sdX3r9wFyM9fUx4BkqzZ9Oguf1/E/mT5crPxODltd7nrBNHyCeYTbkdhaCaPVKG9XA9v5uvqR1k0W
 cYBa6TpSSgwgig/toAQUTU/By1bAE9Coyf2KXw3bl9LubIJU1W5PQguCUy/FhN4G46R9A1XyAa736
 COVW8ue8usnlKGG0GlIRRA==;
Date: Wed, 29 Jan 2025 18:35:06 +0200
Message-Id: <86bjvpmvd1.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <CA+q8srmhNQX5CDiJE3AbnvWBOWzGNtcYKp3i2oqfTxgMUirMiA@HIDDEN>
 (message from Nicolas Sarlin on Wed, 29 Jan 2025 17:02:16 +0100)
References: <CA+q8srkNwSaojXOMvNGnBPcFW_uBiZJuwqXxuB+1hXgbW5-v4A@HIDDEN>
 <86plk5n505.fsf@HIDDEN>
 <CA+q8srmhNQX5CDiJE3AbnvWBOWzGNtcYKp3i2oqfTxgMUirMiA@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 (---)

> From: Nicolas Sarlin <nico.sarlin@HIDDEN>
> Date: Wed, 29 Jan 2025 17:02:16 +0100
> Cc: 75922 <at> debbugs.gnu.org
> 
> On Wed, 29 Jan 2025 at 14:06, Eli Zaretskii <eliz@HIDDEN> wrote:
> >
> > The profile says most of the time is spent in sit-for called from
> > lsp-request-while-no-input.  First, sit-for is not supposed to consume
> > CPU, because it's a waiting function.  Are you sure this profile was
> > taken when Emacs was hogging CPU?
> >
> > And second, lsp-mode is not part of Emacs, so if indeed the above is a
> > profile representative of high CPU load, I suggest to report this to
> > the developers of lsp-mode first, even though the problem appears only
> > in the PGTK build.
> >
> > Thanks.
> 
> Hi, thank you for your answer.
> Yes, this profile was collected during an emacs freeze. It took me a
> few second (maybe 10) after `profiler-start` to trigger the freeze,
> then again a few seconds of freeze, then I ran `profiler-stop`
> directly after. During the freeze I had one CPU core constantly
> running at 100%.

But maybe the process which was consuming the CPU at that time was not
Emacs?  Because sit-for should not consume CPU, it just waits for some
input (or for timeout).  Is it possible that while Emacs waited, some
other process, perhaps the LSP server itself, was spinning the CPU?




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75922: CPU hogs with pgtk
Resent-From: Pip Cet <pipcet@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 29 Jan 2025 17:30:02 +0000
Resent-Message-ID: <handler.75922.B75922.173817179524661 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75922
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Nicolas Sarlin <nico.sarlin@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, 75922 <at> debbugs.gnu.org
Received: via spool by 75922-submit <at> debbugs.gnu.org id=B75922.173817179524661
          (code B ref 75922); Wed, 29 Jan 2025 17:30:02 +0000
Received: (at 75922) by debbugs.gnu.org; 29 Jan 2025 17:29:55 +0000
Received: from localhost ([127.0.0.1]:42841 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tdBsx-0006Pg-6l
	for submit <at> debbugs.gnu.org; Wed, 29 Jan 2025 12:29:55 -0500
Received: from mail-4322.protonmail.ch ([185.70.43.22]:22719)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <pipcet@HIDDEN>)
 id 1tdBsu-0006PO-70
 for 75922 <at> debbugs.gnu.org; Wed, 29 Jan 2025 12:29:53 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
 s=protonmail3; t=1738171785; x=1738430985;
 bh=NIb0UjdWyC0bxnwHITJhISMsRuUOe+8iYq5yVjCVIlw=;
 h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:
 Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:
 Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post;
 b=Z/RPB3QDfpxezyZeGqecFnoVcXAnm4LqEzCa8jFS9LY1mE+e7mSEecdwX0Et6awwL
 Nn+veIbyiZxGaeuoEENvyQbTEgmdqvazXayZ2KrV5+XP9UQZC1kScQLUmE/wYXkcC7
 6x00PfM7QXs7Tws9xT7sUGSx/8VK3k9elG+pzPty4UzxKXVlcgR7puA1KalLejxLwV
 8ZH4GMGLxmCUQLGa/d2gx2v0cMEys5GhxKRno8DjpOiGq6hCdAiL0UWOEf04xHt3/J
 NzMr8WGeKNMAHthFzwO4NSTBfunWaaNvXgG5Wc1c4EpymzbTNykwINqNxezsmJc40y
 GaZqlNfBKMT1w==
Date: Wed, 29 Jan 2025 17:29:43 +0000
From: Pip Cet <pipcet@HIDDEN>
Message-ID: <877c6do7f1.fsf@HIDDEN>
In-Reply-To: <CA+q8srmhNQX5CDiJE3AbnvWBOWzGNtcYKp3i2oqfTxgMUirMiA@HIDDEN>
References: <CA+q8srkNwSaojXOMvNGnBPcFW_uBiZJuwqXxuB+1hXgbW5-v4A@HIDDEN>
 <86plk5n505.fsf@HIDDEN>
 <CA+q8srmhNQX5CDiJE3AbnvWBOWzGNtcYKp3i2oqfTxgMUirMiA@HIDDEN>
Feedback-ID: 112775352:user:proton
X-Pm-Message-ID: cb269135482a0e1ba92e3778cea670b1707a0103
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 (-)

"Nicolas Sarlin" <nico.sarlin@HIDDEN> writes:

> On Wed, 29 Jan 2025 at 14:06, Eli Zaretskii <eliz@HIDDEN> wrote:
>>
>> > From: Nicolas Sarlin <nico.sarlin@HIDDEN>
>> > Date: Wed, 29 Jan 2025 12:05:16 +0100
>> >
>> > I'm using lsp-mode with corfu on the emacs-30 branch, and I get extrem=
ely
>> > frequent CPU hogs (CPU runs at 100% for a few seconds) while typing
>> > code. I report this as an emacs bug because it seems to only occurs wh=
en
>> > emacs is compiled with pgtk. If I rebuild emacs with "make bootstrap
>> > configure=3Ddefault" the bug disapears.
>> >
>> > Here is a profiler record:
>> >        11152  91% - corfu--post-command
>> >        11152  91%  - corfu--exhibit
>> >        11043  90%   - corfu--update
>> >        10891  88%    - corfu--recompute
>> >        10891  88%     - corfu--filter-completions
>> >        10891  88%      - completion-all-completions
>> >        10891  88%       - completion--nth-completion
>> >        10891  88%        - seq-some
>> >        10891  88%         - seq-do
>> >        10891  88%          - mapc
>> >        10891  88%           - #<byte-code-function AC1>
>> >        10891  88%            - #<byte-code-function AD0>
>> >        10891  88%             - lsp-completion-passthrough-all-complet=
ions
>> >        10891  88%              - #<byte-code-function 4B5>
>> >        10891  88%               - #<byte-code-function 4DE>
>> >        10888  88%                - lsp-request-while-no-input
>> >        10888  88%                 - sit-for
>>
>> The profile says most of the time is spent in sit-for called from
>> lsp-request-while-no-input.  First, sit-for is not supposed to consume
>> CPU, because it's a waiting function.  Are you sure this profile was
>> taken when Emacs was hogging CPU?
>>
>> And second, lsp-mode is not part of Emacs, so if indeed the above is a
>> profile representative of high CPU load, I suggest to report this to
>> the developers of lsp-mode first, even though the problem appears only
>> in the PGTK build.
>>
>> Thanks.
>
> Hi, thank you for your answer.
> Yes, this profile was collected during an emacs freeze. It took me a
> few second (maybe 10) after `profiler-start` to trigger the freeze,
> then again a few seconds of freeze, then I ran `profiler-stop`
> directly after. During the freeze I had one CPU core constantly
> running at 100%.

My guess is it's this code in lsp-mode.el:

              (while (not (or resp-error resp-result (input-pending-p)))
                (catch 'lsp-done
                  (sit-for
                   (if expected-time (- expected-time send-time) 1)))
                (setq send-time (float-time))
                (when (and expected-time (< expected-time send-time))
                  (error "Timeout while waiting for response.  Method: %s" =
method)))

This code appears to want to reliquish the CPU for the next
lsp-response-timeout (default 10) seconds, so it calls sit-for with an
argument close to 10.0, or 1 if no timeout is set.

The behavior of sit-for is to return immediately if there is pending
input, ignoring the timeout argument.

In this case, this loop will use all of the CPU until whatever it is
actually waiting for happens, assuming a single "input event" (a
keypress is one, but certain kinds of mouse movement or a similar event
can also cause sit-for to exit immediately) has happened.

Some other places also in that file may work less than optimally when
sit-for returns immediately, also.

So this seems most likely like a bug there, and it may be triggered more
by pgtk/wayland because of such details as key repeat being handled by
the application rather than what used to be the X server.

I'm slightly surprised at your perf report, but at least the last part
doesn't seem inconsistent with that interpretation.

Once the bug is fixed, it would be great to hear how the documentation
of sit-for could be improved.  If that doesn't work, we might even want
to detect situations in which sit-for is called repeatedly with a
timeout argument even though no input was handled in the meantime.

Pip






Last modified: Wed, 29 Jan 2025 17:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.