X-Loop: help-debbugs@HIDDEN Subject: bug#76964: 31.0.50; completion-preview-mode uses a lot of CPU Resent-From: Geza Herman <geza.herman@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Tue, 11 Mar 2025 23:09:02 +0000 Resent-Message-ID: <handler.76964.B.1741734518445 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 76964 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 76964 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.1741734518445 (code B ref -1); Tue, 11 Mar 2025 23:09:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Mar 2025 23:08:38 +0000 Received: from localhost ([127.0.0.1]:46253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ts8iD-000077-Do for submit <at> debbugs.gnu.org; Tue, 11 Mar 2025 19:08:37 -0400 Received: from lists.gnu.org ([2001:470:142::17]:52294) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <geza.herman@HIDDEN>) id 1ts8iA-00006m-CL for submit <at> debbugs.gnu.org; Tue, 11 Mar 2025 19:08:35 -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 <geza.herman@HIDDEN>) id 1ts8hx-0001Ti-NE for bug-gnu-emacs@HIDDEN; Tue, 11 Mar 2025 19:08:22 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <geza.herman@HIDDEN>) id 1ts8hr-0003Dy-5X for bug-gnu-emacs@HIDDEN; Tue, 11 Mar 2025 19:08:21 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3913fdd0120so1991355f8f.0 for <bug-gnu-emacs@HIDDEN>; Tue, 11 Mar 2025 16:08:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741734488; x=1742339288; darn=gnu.org; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=taslElpV47ANFIaANQnhSyimc3qgii0XJUj6D8d3nV4=; b=Dg+pTMQbkQfaPMgDN5pzv0N2ce0hcoFZXvmwX9e4P+5PIpXYmcCiwhcZP9AuzERbms Dkrep9QnrkCPLFbIzFF/RJ6Wn9fdCMYPQD9LEWecaG0vRhn1ZZ9N/9gW1jkm+gfFMAAq B7rRmlBqjlpva/agzMk7tx1GDywHEEiwx+CGwcPQcTH1PxkhMsDQ8mirvfxMYyg24kNz CKf/HtX5PAjet4L5stEKUoLh6JnXK5tc1BHlNwdabqtxCaiUW57ixdZwxAvG6cB64DaL E4T5OLwESqaBm0NgLXiKubdAqiQQCKu129w/uViKwF6xSEexj9ph8QaZeDcOxEFAP15t EzyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741734488; x=1742339288; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=taslElpV47ANFIaANQnhSyimc3qgii0XJUj6D8d3nV4=; b=IVyRCGmaoCZly8wmaYDovbcsgJH5BnV2DO5JBCQIF1n6mtKaLnhLmfZ7QVpPseC6d6 eFyRdv6qpcxRhxtXp2cqvC15cEVerkXBMwWTO/6UTWVBzCjsa86J/HtKKfle/ZmYi0AZ 5vhUw2cCwn2PZDR59J5cMuXw7q13yRewK9DpODdVeTMsG0uwzxGoD4HHtoD1BnxDeJpp kbEbeLSvWEy59Guj6xjf598uVFoTSfP0Vm1fmu3qyISVYiIgpNVy95HoFcumzqVAiTxj raoYG62oqY+lYGUAvs2EQTmu/Oc1/sdTPD+vOzoBXOt0IOqKeogZPMmXxlNeHrnF1tba lJbA== X-Gm-Message-State: AOJu0YxM1QjP6tiYf72KXSe8C6QUuKrLcwJJJezyKLc18AjWeI5tINVs DZjWuiOnOF8PwiWQXUS6GBxdc6+U2G49DNT22xhZkIkF+iF7j9wmfBEscg== X-Gm-Gg: ASbGncvQxib41Z/uWCqW2FCb8pNKdcUTZaO9NR02uw/wTNDpoF3gKirbq/ClOgS0HLq pRodi1MNBwzoD00/4mBI/6TdlTid1gYDzW6ryJ/6Jkpbt5xf9AgGJ33ZwDmYvIcFfR04UxphL/4 Sx0Abnpu8q01n5cjPV//GbqalXYZKZYr/sj8hInyLLTKeAJbbtZTVeHVB7zmbTom3Z7aB13ONrk 79QCcZpRbIdrAEH6hNWkWfsdnRGQo8MsKovd2ZWBt5inRPI41R9G4uY5oH+MB6PnnB8ON3z7ou/ 5/fXsh5RQnG+tS+2ITIZBmNvuYGBt3I/iHZQmEHwF+6qK8aEwKGREdPoNJbElwQrLN2/J3+nHho A9LtQvBvhApXnww== X-Google-Smtp-Source: AGHT+IE6SMKVcOYNsrX9mufw6yGJza/EfQpihXvj/WzxIy248YRI1fyQP1h/xJ74wZ16sWJTW9x0hA== X-Received: by 2002:a5d:6d04:0:b0:390:f0ff:2bf8 with SMTP id ffacd0b85a97d-39132d05f78mr15534566f8f.10.1741734488361; Tue, 11 Mar 2025 16:08:08 -0700 (PDT) Received: from [192.168.1.65] (1F2EF086.nat.pool.telekom.hu. [31.46.240.134]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3912c0194f2sm19666271f8f.54.2025.03.11.16.08.06 for <bug-gnu-emacs@HIDDEN> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Mar 2025 16:08:07 -0700 (PDT) Message-ID: <dd4c510c-26f0-4922-99cd-8bfa32fdd07c@HIDDEN> Date: Wed, 12 Mar 2025 00:08:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Geza Herman <geza.herman@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=geza.herman@HIDDEN; helo=mail-wr1-x42d.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, 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 (/) When moving around a buffer with completion-preview-mode enabled, CPU usage becomes very high. Profiling the problem reveals that with completion-preview-mode, redisplay_internal takes much more CPU. The problem is in completion-preview--post-command, which calls (completion-preview-active-mode -1). For some reason, even though this should be a nop when just moving around a buffer, it forces emacs to do some more thorough redisplay. If I change this code to "(when completion-preview-active-mode (completion-preview-active-mode -1))", the problem goes away. I think the problem is inside the define-minor-mode macro, because if I change completion-preview-active-mode to an empty minor mode definition: (define-minor-mode completion-preview-active-mode "Mode for when the completion preview is shown." :interactive nil) the problem still happens. Note: looking inside the define-minor-mode macro, I see a (force-mode-line-update) call. I'm not sure it's related, but it has a chance that it is. In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, cairo version 1.18.2) of 2025-03-11 built on okoska Repository revision: 57f7d5f44a136c95958030b7920e5eca4b285309 Repository branch: HEAD Windowing system distributor 'The X.Org Foundation', version 11.0.12101013 System Description: Debian GNU/Linux trixie/sid Configured using: 'configure --with-native-compilation --without-compress-install --without-gconf --without-gsettings --without-dbus --with-small-ja-dic --with-json --with-xinput2 --with-x-toolkit=no --with-tree-sitter --with-cairo --with-cairo-xcb --disable-silent-rules --disable-gc-mark-trace 'CFLAGS=-mtune=native -march=native -g3 -O3'' Configured features: ACL CAIRO FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY OLDXMENU PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TREE_SITTER WEBP X11 XDBE XIM XINERAMA XINPUT2 XPM XRANDR ZLIB Important settings: value of $LC_ALL: C.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=none locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr compile comint ansi-osc ansi-color ring comp-run bytecomp byte-compile comp-common rx emacsbug lisp-mnt message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen 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 inotify lcms2 dynamic-setting font-render-setting cairo xinput2 x multi-tty move-toolbar make-network-process tty-child-frames native-compile emacs) Memory information: ((conses 16 85565 10951) (symbols 48 6794 0) (strings 32 23179 2179) (string-bytes 1 688051) (vectors 16 15115) (vector-slots 8 174583 11632) (floats 8 35 1) (intervals 56 332 0) (buffers 992 12))
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: Geza Herman <geza.herman@HIDDEN> Subject: bug#76964: Acknowledgement (31.0.50; completion-preview-mode uses a lot of CPU) Message-ID: <handler.76964.B.1741734518445.ack <at> debbugs.gnu.org> References: <dd4c510c-26f0-4922-99cd-8bfa32fdd07c@HIDDEN> X-Gnu-PR-Message: ack 76964 X-Gnu-PR-Package: emacs Reply-To: 76964 <at> debbugs.gnu.org Date: Tue, 11 Mar 2025 23:09: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 76964 <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 76964: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D76964 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#76964: 31.0.50; completion-preview-mode uses a lot of CPU Resent-From: Eshel Yaron <me@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Wed, 12 Mar 2025 06:49:01 +0000 Resent-Message-ID: <handler.76964.B76964.17417621247348 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 76964 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Geza Herman <geza.herman@HIDDEN> Cc: 76964 <at> debbugs.gnu.org Received: via spool by 76964-submit <at> debbugs.gnu.org id=B76964.17417621247348 (code B ref 76964); Wed, 12 Mar 2025 06:49:01 +0000 Received: (at 76964) by debbugs.gnu.org; 12 Mar 2025 06:48:44 +0000 Received: from localhost ([127.0.0.1]:47063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tsFtU-0001uS-7M for submit <at> debbugs.gnu.org; Wed, 12 Mar 2025 02:48:44 -0400 Received: from mail.eshelyaron.com ([107.175.124.16]:32792 helo=eshelyaron.com) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1tsFtR-0001uI-Ci for 76964 <at> debbugs.gnu.org; Wed, 12 Mar 2025 02:48:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1741762120; bh=930Jqm1AWljUd0Hcyu5wGtwGz4sWw4IYjjXX0p6G9nw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=J7W/pyJl5xgst9Sh9KK7ksuOZlr6lP9R8qw6lrRVxiI3jP/53PgGtjy36uGhmPHHm +/KTxw//X3ggRTWHd9VB+UDcYtEUct5mLMl2fKOAHb3VsP/3KYhdX52xrFr/na4l53 t3GLBYyKnGw9oMeVEkXCccAEY3e+H4I0fdhglp2AP6+2uNLzV70bhPu9zdLPpEXcHZ C9/z92i5WVkWIE2W56KN/lVBFM2xX4VQeRFQkAWWZz8o0j0RF+8nc5zx/iRF2iCAQs dlrJhTHVzkTQqZDkebaDk9k/ijNNuoD5F5+w5FAZspl084RUniKB4ykmfxJb9YqBJJ exQ2BUrl7JJ2Q== From: Eshel Yaron <me@HIDDEN> In-Reply-To: <dd4c510c-26f0-4922-99cd-8bfa32fdd07c@HIDDEN> References: <dd4c510c-26f0-4922-99cd-8bfa32fdd07c@HIDDEN> Date: Wed, 12 Mar 2025 07:48:38 +0100 Message-ID: <m14izyiw1l.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) 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 (-) Hi Geza, Geza Herman <geza.herman@HIDDEN> writes: > When moving around a buffer with completion-preview-mode enabled, CPU > usage becomes very high. > > Profiling the problem reveals that with completion-preview-mode, > redisplay_internal takes much more CPU. > > The problem is in completion-preview--post-command, which calls > (completion-preview-active-mode -1). For some reason, even though this > should be a nop when just moving around a buffer, it forces emacs to > do some more thorough redisplay. If I change this code to "(when > completion-preview-active-mode (completion-preview-active-mode -1))", > the problem goes away. > > I think the problem is inside the define-minor-mode macro, because if > I change completion-preview-active-mode to an empty minor mode > definition: > > (define-minor-mode completion-preview-active-mode > =C2=A0 "Mode for when the completion preview is shown." > =C2=A0 :interactive nil) > > the problem still happens. Note: looking inside the define-minor-mode > macro, I see a (force-mode-line-update) call. I'm not sure it's > related, but it has a chance that it is. Thanks for investigating and reporting. I think that conditioning the (completion-preview-active-mode -1) in completion-preview--post-command as you suggest makes sense. Would you like to provide a simple patch with that change? Best, Eshel
X-Loop: help-debbugs@HIDDEN Subject: bug#76964: 31.0.50; completion-preview-mode uses a lot of CPU Resent-From: Eshel Yaron <me@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sun, 16 Mar 2025 09:18:02 +0000 Resent-Message-ID: <handler.76964.B76964.174211665125274 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 76964 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Geza Herman <geza.herman@HIDDEN> Cc: 76964 <at> debbugs.gnu.org Received: via spool by 76964-submit <at> debbugs.gnu.org id=B76964.174211665125274 (code B ref 76964); Sun, 16 Mar 2025 09:18:02 +0000 Received: (at 76964) by debbugs.gnu.org; 16 Mar 2025 09:17:31 +0000 Received: from localhost ([127.0.0.1]:45420 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ttk7d-0006ZR-FN for submit <at> debbugs.gnu.org; Sun, 16 Mar 2025 05:17:30 -0400 Received: from mail.eshelyaron.com ([107.175.124.16]:51062 helo=eshelyaron.com) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1ttk7a-0006Yh-4o for 76964 <at> debbugs.gnu.org; Sun, 16 Mar 2025 05:17:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1742116645; bh=lj3+b8fSf+sxhqtcDEoQdLhVbEhfmqMgnzdE06BRYv0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=EsdDRdScGKGl4JKc+UX0NQOaadnJKktUrTLIkC0Vl+6VNGuVQPGOIULKZM533ostb G+fc1u3d5M3obysi9mfEfQ+v/z0ccmbTTYgCkk6yviWAHT2dLvBL4KBppyP3CxPDrg BY0cArHejdHvwwkG3Udy+M/uwIwVlSsTT2K4IBX8vB/BDvJZuPNBmRdctILJkht7Bi DK9QVlsb7LD7d4XYhlOypfn2xF4NPBd0+QjNj0drfGA26BTRNvd6JKglky/PS/nJIM Y3uEmygGOyediWz3rSlFJZmyYRK9mIvbNU+uICtppw4RcRV0FJDwHtp1YiXQFRTM+s +bpc6508jUNQw== From: Eshel Yaron <me@HIDDEN> In-Reply-To: <m14izyiw1l.fsf@HIDDEN> References: <dd4c510c-26f0-4922-99cd-8bfa32fdd07c@HIDDEN> <m14izyiw1l.fsf@HIDDEN> Date: Sun, 16 Mar 2025 10:17:23 +0100 Message-ID: <m1msdlibbw.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) 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 (-) Eshel Yaron <me@HIDDEN> writes: > Geza Herman <geza.herman@HIDDEN> writes: > >> When moving around a buffer with completion-preview-mode enabled, CPU >> usage becomes very high. >> >> Profiling the problem reveals that with completion-preview-mode, >> redisplay_internal takes much more CPU. >> >> The problem is in completion-preview--post-command, which calls >> (completion-preview-active-mode -1). For some reason, even though this >> should be a nop when just moving around a buffer, it forces emacs to >> do some more thorough redisplay. If I change this code to "(when >> completion-preview-active-mode (completion-preview-active-mode -1))", >> the problem goes away. >> >> I think the problem is inside the define-minor-mode macro, because if >> I change completion-preview-active-mode to an empty minor mode >> definition: >> >> (define-minor-mode completion-preview-active-mode >> =C2=A0 "Mode for when the completion preview is shown." >> =C2=A0 :interactive nil) >> >> the problem still happens. Note: looking inside the define-minor-mode >> macro, I see a (force-mode-line-update) call. I'm not sure it's >> related, but it has a chance that it is. > > Thanks for investigating and reporting. I think that conditioning the > (completion-preview-active-mode -1) in completion-preview--post-command > as you suggest makes sense. Would you like to provide a simple patch > with that change? I've now pushed such a change along with some additional commentary to the emacs-30 branch in commit b6b4a080a3a. It should make its way to master soon enough. Could you please check whether that improves performance for you? Thanks, Eshel
X-Loop: help-debbugs@HIDDEN Subject: bug#76964: 31.0.50; completion-preview-mode uses a lot of CPU Resent-From: Geza Herman <geza.herman@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sun, 16 Mar 2025 15:50:05 +0000 Resent-Message-ID: <handler.76964.B76964.174214015514523 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 76964 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eshel Yaron <me@HIDDEN> Cc: 76964 <at> debbugs.gnu.org Received: via spool by 76964-submit <at> debbugs.gnu.org id=B76964.174214015514523 (code B ref 76964); Sun, 16 Mar 2025 15:50:05 +0000 Received: (at 76964) by debbugs.gnu.org; 16 Mar 2025 15:49:15 +0000 Received: from localhost ([127.0.0.1]:50418 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ttqEk-0003m8-SS for submit <at> debbugs.gnu.org; Sun, 16 Mar 2025 11:49:15 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:49300) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <geza.herman@HIDDEN>) id 1ttqEi-0003lB-BY for 76964 <at> debbugs.gnu.org; Sun, 16 Mar 2025 11:49:13 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-390e3b3d3f4so2121266f8f.2 for <76964 <at> debbugs.gnu.org>; Sun, 16 Mar 2025 08:49:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742140146; x=1742744946; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=QOJRkIq+KscdOw7fL0U2LZJz2PsjT5gK2UjVWxkebWs=; b=DNFcALek6nKl/19k3NI1WxnVEEKBQ4ZC6yly9FQByF1yx1yfP1Nkgaw8KpffjsEV1J f6tNIxiJ1jMelgTbgM3BcL2U+G2ZpMpCi7y5a8kFmcY+EQuGxfKU3Y72PvJ9hYRqESzd zCX35IWu74NEBFVFrLKm29W3sOFQO8H5FyJuuYL7xFiDBBC4RhNGN8sLATWGIHwuxmw5 YxEnHC1SpGr/Zu2dd58q4fDKN2HJs28kqC9WdZLWGS/lajoY6/KMqJnNxExdFahW96g0 qw5fv8cVkscR5e2Czs7o+9LPPDG2LeC8zzFJjeqe+pF97yQIIUPEg5gy4bFG8zXR/SsF SCzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742140146; x=1742744946; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QOJRkIq+KscdOw7fL0U2LZJz2PsjT5gK2UjVWxkebWs=; b=Pa9XIo8lT2ojY51o6/P2EZMUi/+E/X/oo0FC8ODgBd25jr8jH9n4HCwpuVqeK6wB7Y zowyjYdquPV10F8Pbl/f1WeqbsxlAd9i6FBjxbDZcKmpMALG3gsd+9QVlr2zi8IMxZLu yRYtXeTLmVBtxLIs+Ww9Ux1Y+i37ZnMMv14xsW/HrirbkZHoPiwYsgvcoUA7yMovVDHs gzVWrwCtZupldrwGGyBLxoRNFi22jURfEhBxbNtxr0zqh8d1rxcjQlYRIYpuRLcG6daZ eRsN8LNp4/D6ESSnCek79v6f+DqpyOpP8XwE17Ay4SGXL7sZtLoWk6nP1oxScCFtbSO7 mCYg== X-Gm-Message-State: AOJu0Yw9I1Q/i/T2jIZfXDTQLFXAMd33RTwuhxbuoQhXk25in+JZtZjR d195EGu3UQ4fmtbAvC7R83arkT42ZmOqWZ5xF4ykVrew+2+6nOnzTWlOdQ== X-Gm-Gg: ASbGncuCL3W13Qv8XfkR6YVzCtTXESqyiyMy8VbvefrSC/3GxGUFkGBX+5eOlDYQNUK KKhJXewVZmovgZeEseMgBCscaIdPQYPDdcc2MnQEhcLYUsjGQ2Sg/c21ZfwA5xyP3mKxRY6kFeC uX194NWyE56DPFK2sWPhlISCmZ9uZcKrzJ0WlEs4LQrqMU/5iggSprxk1JtaWskzqOrJc7FQmeK wSf1lzKlrEiRfw+sXdfwFwjo4/MKgX9pJp+jTVnP8ZU+E0j/escULapZNYDEe9C+8nF5G90woYq Qu7/GPUA8uXR+IsEmqcchRpF8Zd5enzS33354p/e7sG8VjK+OYP7C3q3XXtj84u2+Ybu127Iz06 p4m4= X-Google-Smtp-Source: AGHT+IFwZdOW+H8+gRadwmdbmoSVnevJ/26+o4fgt9CTnMpkf/dsgUZHOKTd2f7CBK5ofzlGVm5yAw== X-Received: by 2002:a05:6000:4012:b0:391:4389:f36a with SMTP id ffacd0b85a97d-3971ffb3cefmr13042790f8f.48.1742140145483; Sun, 16 Mar 2025 08:49:05 -0700 (PDT) Received: from [192.168.1.65] (1F2EF7F2.nat.pool.telekom.hu. [31.46.247.242]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43d200fae32sm80195055e9.31.2025.03.16.08.49.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 16 Mar 2025 08:49:05 -0700 (PDT) Message-ID: <5aface42-2b80-4612-bf81-0e7992feb90a@HIDDEN> Date: Sun, 16 Mar 2025 16:49:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: <dd4c510c-26f0-4922-99cd-8bfa32fdd07c@HIDDEN> <m14izyiw1l.fsf@HIDDEN> <m1msdlibbw.fsf@HIDDEN> Content-Language: en-US From: Geza Herman <geza.herman@HIDDEN> In-Reply-To: <m1msdlibbw.fsf@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 (-) Hi Eshel, Thanks, the new version seems to work correctly! (Sorry, I was meant to create a patch, for before that I asked a question in emacs-devel about the behavior of define-minor-mode, and I was waiting for a response - got none so far) Geza On 3/16/25 10:17 AM, Eshel Yaron wrote: > Eshel Yaron <me@HIDDEN> writes: > >> Geza Herman <geza.herman@HIDDEN> writes: >> >>> When moving around a buffer with completion-preview-mode enabled, CPU >>> usage becomes very high. >>> >>> Profiling the problem reveals that with completion-preview-mode, >>> redisplay_internal takes much more CPU. >>> >>> The problem is in completion-preview--post-command, which calls >>> (completion-preview-active-mode -1). For some reason, even though this >>> should be a nop when just moving around a buffer, it forces emacs to >>> do some more thorough redisplay. If I change this code to "(when >>> completion-preview-active-mode (completion-preview-active-mode -1))", >>> the problem goes away. >>> >>> I think the problem is inside the define-minor-mode macro, because if >>> I change completion-preview-active-mode to an empty minor mode >>> definition: >>> >>> (define-minor-mode completion-preview-active-mode >>> "Mode for when the completion preview is shown." >>> :interactive nil) >>> >>> the problem still happens. Note: looking inside the define-minor-mode >>> macro, I see a (force-mode-line-update) call. I'm not sure it's >>> related, but it has a chance that it is. >> Thanks for investigating and reporting. I think that conditioning the >> (completion-preview-active-mode -1) in completion-preview--post-command >> as you suggest makes sense. Would you like to provide a simple patch >> with that change? > I've now pushed such a change along with some additional commentary to > the emacs-30 branch in commit b6b4a080a3a. It should make its way to > master soon enough. Could you please check whether that improves > performance for you? > > > Thanks, > > Eshel >
X-Loop: help-debbugs@HIDDEN Subject: bug#76964: 31.0.50; completion-preview-mode uses a lot of CPU Resent-From: Eshel Yaron <me@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sun, 16 Mar 2025 18:15:01 +0000 Resent-Message-ID: <handler.76964.B76964.174214889710277 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 76964 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Geza Herman <geza.herman@HIDDEN> Cc: 76964 <at> debbugs.gnu.org Received: via spool by 76964-submit <at> debbugs.gnu.org id=B76964.174214889710277 (code B ref 76964); Sun, 16 Mar 2025 18:15:01 +0000 Received: (at 76964) by debbugs.gnu.org; 16 Mar 2025 18:14:57 +0000 Received: from localhost ([127.0.0.1]:50656 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ttsVl-0002fg-Ea for submit <at> debbugs.gnu.org; Sun, 16 Mar 2025 14:14:57 -0400 Received: from mail.eshelyaron.com ([107.175.124.16]:52542 helo=eshelyaron.com) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1ttsVi-0002fT-Cf; Sun, 16 Mar 2025 14:14:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1742148893; bh=s+9nBhanIEy3jb8T+BmSNOyaWnPblKFphaE8UZbIXBA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=aM+xh+iri5gFPwYLz06JHmLkmvg4mXddMHGsUTnbVO89TotyQdUcl4U6oLcap5ft0 L5A5+Gfws48M8T1g4PT5q0TcxfKPp8XF7Twe6uVJHAxhVlwiBHVmVJhiWiFxf6YO91 h5hEIFswzpjcUEe0V7+Zg2klvSdtbqHNpN7elwFqVhMZ94paQx3PzSVbPxXGbfwk07 +D7k0EUDaKWQJs2Le/1opwgGdyJEzUxT49Dgw+/kbpCQSMNL77qxPRM0m/DiVI7wcH yy9TjKh3j9ElEFoi+3EXTM7aGrRAq37wOpiZ8rq08Q1DvPrQVVEHzCPNMSoTHTMWvZ 9ObhXWP1AFV/A== From: Eshel Yaron <me@HIDDEN> In-Reply-To: <5aface42-2b80-4612-bf81-0e7992feb90a@HIDDEN> References: <dd4c510c-26f0-4922-99cd-8bfa32fdd07c@HIDDEN> <m14izyiw1l.fsf@HIDDEN> <m1msdlibbw.fsf@HIDDEN> <5aface42-2b80-4612-bf81-0e7992feb90a@HIDDEN> Date: Sun, 16 Mar 2025 19:14:51 +0100 Message-ID: <m1y0x4vo4k.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain 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 (-) close 76964 30.2 quit Geza Herman <geza.herman@HIDDEN> writes: > Hi Eshel, > > Thanks, the new version seems to work correctly! Great, thanks for confirming. > (Sorry, I was meant to create a patch, for before that I asked a > question in emacs-devel about the behavior of define-minor-mode, and I > was waiting for a response - got none so far) Oh, I missed that message. Indeed, if we end up changing define-minor-mode then we'll be able remove this check in completion-preview--post-command. For now, I'm closing this bug. Thanks again, Eshel
Received: (at control) by debbugs.gnu.org; 16 Mar 2025 18:14:58 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 16 14:14:58 2025 Received: from localhost ([127.0.0.1]:50658 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ttsVl-0002fi-RI for submit <at> debbugs.gnu.org; Sun, 16 Mar 2025 14:14:58 -0400 Received: from mail.eshelyaron.com ([107.175.124.16]:52542 helo=eshelyaron.com) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1ttsVi-0002fT-Cf; Sun, 16 Mar 2025 14:14:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1742148893; bh=s+9nBhanIEy3jb8T+BmSNOyaWnPblKFphaE8UZbIXBA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=aM+xh+iri5gFPwYLz06JHmLkmvg4mXddMHGsUTnbVO89TotyQdUcl4U6oLcap5ft0 L5A5+Gfws48M8T1g4PT5q0TcxfKPp8XF7Twe6uVJHAxhVlwiBHVmVJhiWiFxf6YO91 h5hEIFswzpjcUEe0V7+Zg2klvSdtbqHNpN7elwFqVhMZ94paQx3PzSVbPxXGbfwk07 +D7k0EUDaKWQJs2Le/1opwgGdyJEzUxT49Dgw+/kbpCQSMNL77qxPRM0m/DiVI7wcH yy9TjKh3j9ElEFoi+3EXTM7aGrRAq37wOpiZ8rq08Q1DvPrQVVEHzCPNMSoTHTMWvZ 9ObhXWP1AFV/A== From: Eshel Yaron <me@HIDDEN> To: Geza Herman <geza.herman@HIDDEN> Subject: Re: bug#76964: 31.0.50; completion-preview-mode uses a lot of CPU In-Reply-To: <5aface42-2b80-4612-bf81-0e7992feb90a@HIDDEN> References: <dd4c510c-26f0-4922-99cd-8bfa32fdd07c@HIDDEN> <m14izyiw1l.fsf@HIDDEN> <m1msdlibbw.fsf@HIDDEN> <5aface42-2b80-4612-bf81-0e7992feb90a@HIDDEN> Date: Sun, 16 Mar 2025 19:14:51 +0100 Message-ID: <m1y0x4vo4k.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control Cc: 76964 <at> debbugs.gnu.org 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 (-) close 76964 30.2 quit Geza Herman <geza.herman@HIDDEN> writes: > Hi Eshel, > > Thanks, the new version seems to work correctly! Great, thanks for confirming. > (Sorry, I was meant to create a patch, for before that I asked a > question in emacs-devel about the behavior of define-minor-mode, and I > was waiting for a response - got none so far) Oh, I missed that message. Indeed, if we end up changing define-minor-mode then we'll be able remove this check in completion-preview--post-command. For now, I'm closing this bug. Thanks again, Eshel
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.