unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu use
@ 2023-02-03 18:47 J. Scott Berg
  2023-02-04  0:48 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: J. Scott Berg @ 2023-02-03 18:47 UTC (permalink / raw)
  To: 61258

Emacs built with pgtk. Editing in f90 mode, though I don't think this is
important. Display is WSLg. Severe input lag, to the point off becoming
unusable, gets worse with more frames (or just time?). Heavy CPU usage by
emacs while doing anything. Problem not seen when not built with pgtk.

In GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.36, cairo version 1.17.6) of 2023-02-01 built on LAD-158343
Repository revision: f91bf9df892417a2e4add6d0d77ac5123a579bfc
Repository branch: emacs-29
System Description: Arch Linux

Configured using:
 'configure --prefix=/home/jsberg/opt/emacs-230201-f91bf9df892
 --with-pgtk --with-native-compilation'

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

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

Major mode: F90

Minor modes in effect:
  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
  line-number-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 emacsbug message yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util time-date mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils cmake-font-lock cmake-mode rst compile
text-property-search thingatpt vc-svn python project pcase treesit
comint ansi-osc ring ansi-color calc-arith calc-misc calc-math calc-alg
calc-ext calc-menu calc calc-loaddefs rect calc-macs misearch
multi-isearch comp comp-cstr warnings rx cl-extra help-mode vc-git
diff-mode easy-mmode vc-dispatcher f90 cus-edit pp cus-start cus-load
icons wid-edit cmake-font-lock-autoloads cmake-mode-autoloads
yaml-mode-autoloads info auctex-autoloads tex-site
gnuplot-mode-autoloads 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 cl-seq
eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv
bytecomp byte-compile url-vars cl-loaddefs cl-lib 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 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 make-network-process native-compile emacs)

Memory information:
((conses 16 241683 12843)
 (symbols 48 16164 0)
 (strings 32 56433 2622)
 (string-bytes 1 1716654)
 (vectors 16 35561)
 (vector-slots 8 620187 15083)
 (floats 8 119 162)
 (intervals 56 6002 0)
 (buffers 976 27))

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu use
  2023-02-03 18:47 bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu use J. Scott Berg
@ 2023-02-04  0:48 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-02-06 11:51   ` J. Scott Berg
  2023-02-04  8:45 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-01 22:01 ` Fujii Hironori
  2 siblings, 1 reply; 9+ messages in thread
From: Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-02-04  0:48 UTC (permalink / raw)
  To: J. Scott Berg; +Cc: 61258

On Feb 4, 2023, at 02:53, J. Scott Berg <jsberg-bnl@outlook.com> wrote:
> 
> Emacs built with pgtk. Editing in f90 mode, though I don't think this is
> important. Display is WSLg. Severe input lag, to the point off becoming
> unusable, gets worse with more frames (or just time?). Heavy CPU usage by
> emacs while doing anything. Problem not seen when not built with pgtk.

Hello,

Last time I checked, PGTK only aims to support Wayland -- while incidentally also *usually but not always* work in X -- and WSLg is an X server/client thing.  There is even a warning shown when I run my PGTK build on an X DE.  So, intuitively, if my information is correct and up to date, you are not expected to run PGTK build on WSLg and you would need to disable the PGTK flag during config. 

> In GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version
> 3.24.36, cairo version 1.17.6) of 2023-02-01 built on LAD-158343
> Repository revision: f91bf9df892417a2e4add6d0d77ac5123a579bfc
> Repository branch: emacs-29
> System Description: Arch Linux
> 
> Configured using:
> 'configure --prefix=/home/jsberg/opt/emacs-230201-f91bf9df892
> --with-pgtk --with-native-compilation'
> 
> Configured features:
> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
> JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
> PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
> TOOLKIT_SCROLL_BARS WEBP XIM GTK3 ZLIB

Best,


RY





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu use
  2023-02-03 18:47 bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu use J. Scott Berg
  2023-02-04  0:48 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-02-04  8:45 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-01 22:01 ` Fujii Hironori
  2 siblings, 0 replies; 9+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-02-04  8:45 UTC (permalink / raw)
  To: J. Scott Berg; +Cc: 61258

"J. Scott Berg" <jsberg-bnl@outlook.com> writes:

> Emacs built with pgtk. Editing in f90 mode, though I don't think this is
> important. Display is WSLg. Severe input lag, to the point off becoming
> unusable, gets worse with more frames (or just time?). Heavy CPU usage by
> emacs while doing anything. Problem not seen when not built with pgtk.

I cannot reproduce this on GNU/Linux.

We are not going to support MS-Windows by means other than the W32 and
Cygwin builds, so the chances of this being fixed by us is low.

However, patches are always welcome.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu use
  2023-02-04  0:48 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-02-06 11:51   ` J. Scott Berg
  0 siblings, 0 replies; 9+ messages in thread
From: J. Scott Berg @ 2023-02-06 11:51 UTC (permalink / raw)
  To: 61258@debbugs.gnu.org

WSLg is actually a Wayland server, which is why I built pgtk for it.

> -----Original Message-----
> From: Ruijie Yu <ruijie@netyu.xyz>
> Sent: Friday, February 3, 2023 7:48 PM
> To: J. Scott Berg <jsberg-bnl@outlook.com>
> Cc: 61258@debbugs.gnu.org
> Subject: Re: bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu
> use
> 
> On Feb 4, 2023, at 02:53, J. Scott Berg <jsberg-bnl@outlook.com> wrote:
> >
> > Emacs built with pgtk. Editing in f90 mode, though I don't think this is
> > important. Display is WSLg. Severe input lag, to the point off becoming
> > unusable, gets worse with more frames (or just time?). Heavy CPU usage by
> > emacs while doing anything. Problem not seen when not built with pgtk.
> 
> Hello,
> 
> Last time I checked, PGTK only aims to support Wayland -- while
> incidentally also *usually but not always* work in X -- and WSLg is an X
> server/client thing.  There is even a warning shown when I run my PGTK
> build on an X DE.  So, intuitively, if my information is correct and up to
> date, you are not expected to run PGTK build on WSLg and you would need to
> disable the PGTK flag during config.
> 
> > In GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version
> > 3.24.36, cairo version 1.17.6) of 2023-02-01 built on LAD-158343
> > Repository revision: f91bf9df892417a2e4add6d0d77ac5123a579bfc
> > Repository branch: emacs-29
> > System Description: Arch Linux
> >
> > Configured using:
> > 'configure --prefix=/home/jsberg/opt/emacs-230201-f91bf9df892
> > --with-pgtk --with-native-compilation'
> >
> > Configured features:
> > ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
> > JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
> > PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
> > TOOLKIT_SCROLL_BARS WEBP XIM GTK3 ZLIB
> 
> Best,
> 
> 
> RY

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu use
  2023-02-03 18:47 bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu use J. Scott Berg
  2023-02-04  0:48 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-02-04  8:45 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-08-01 22:01 ` Fujii Hironori
  2023-08-02  0:17   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-02 11:49   ` Eli Zaretskii
  2 siblings, 2 replies; 9+ messages in thread
From: Fujii Hironori @ 2023-08-01 22:01 UTC (permalink / raw)
  To: jsberg-bnl, 61258

[-- Attachment #1: Type: text/plain, Size: 625 bytes --]

> Emacs built with pgtk. Editing in f90 mode, though I don't think this is
> important. Display is WSLg. Severe input lag, to the point off becoming
> unusable, gets worse with more frames (or just time?). Heavy CPU usage by
> emacs while doing anything. Problem not seen when not built with pgtk.

I'm observing a similar high CPU usage problem with Emacs 29.1 on WSL1 and
X server, not with WSLg.
As suggested by
https://www.reddit.com/r/emacs/comments/urivlg/high_cpu_usage_in_wsl_with_emacs_29050/
reverting
https://github.com/emacs-mirror/emacs/commit/fa52782f5c4eaef7138534766dfc8a29465785b2
solves the problem for me.

[-- Attachment #2: Type: text/html, Size: 893 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu use
  2023-08-01 22:01 ` Fujii Hironori
@ 2023-08-02  0:17   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-02 11:49   ` Eli Zaretskii
  1 sibling, 0 replies; 9+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-02  0:17 UTC (permalink / raw)
  To: Fujii Hironori; +Cc: 61258, jsberg-bnl

Fujii Hironori <fujii.hironori@gmail.com> writes:

> I'm observing a similar high CPU usage problem with Emacs 29.1 on WSL1
> and X server, not with WSLg.  As suggested by
> https://www.reddit.com/r/emacs/comments/urivlg/high_cpu_usage_in_wsl_with_emacs_29050/
> reverting
> https://github.com/emacs-mirror/emacs/commit/fa52782f5c4eaef7138534766dfc8a29465785b2
> solves the problem for me.

Since WSL1 does not emulate real Linux kernel, and that code has proven
itself hassle-free for GNU/Linux users over the period of a year, this
problem is of very low importance.

Please consider using the W32 or Cygwin configurations instead.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu use
  2023-08-01 22:01 ` Fujii Hironori
  2023-08-02  0:17   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-08-02 11:49   ` Eli Zaretskii
  2023-08-02 13:00     ` J. Scott Berg
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2023-08-02 11:49 UTC (permalink / raw)
  To: Fujii Hironori; +Cc: 61258, jsberg-bnl

> From: Fujii Hironori <fujii.hironori@gmail.com>
> Date: Wed, 2 Aug 2023 07:01:27 +0900
> 
> > Emacs built with pgtk. Editing in f90 mode, though I don't think this is
> > important. Display is WSLg. Severe input lag, to the point off becoming
> > unusable, gets worse with more frames (or just time?). Heavy CPU usage by
> > emacs while doing anything. Problem not seen when not built with pgtk.
> 
> I'm observing a similar high CPU usage problem with Emacs 29.1 on WSL1 and X server, not with
> WSLg.
> As suggested by
> https://www.reddit.com/r/emacs/comments/urivlg/high_cpu_usage_in_wsl_with_emacs_29050/
> reverting
> https://github.com/emacs-mirror/emacs/commit/fa52782f5c4eaef7138534766dfc8a29465785b2
> solves the problem for me.

Thanks, but to do anything with this report we'd need at least to
understand what is causing the high CPU usage.  The linked Reddit post
has a profile, but only before removing those 4 lines.  Perhaps
comparing two profiles, before and after the change, while doing the
same stuff in the same build of Emacs, would give us some ideas.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu use
  2023-08-02 11:49   ` Eli Zaretskii
@ 2023-08-02 13:00     ` J. Scott Berg
  2023-08-03  1:00       ` Fujii Hironori
  0 siblings, 1 reply; 9+ messages in thread
From: J. Scott Berg @ 2023-08-02 13:00 UTC (permalink / raw)
  To: Eli Zaretskii, Fujii Hironori; +Cc: 61258@debbugs.gnu.org

I did some testing on a straight up Ubuntu box running Wayland, and you can see the same increase in CPU usage, though it doesn't seem to be as much of a problem there (on WSL2 it becomes impossible to work at some point, on straight Ubuntu/Wayland it's not bothersome). Doesn't seem to be an issue with the Xorg server.

> -----Original Message-----
> From: Eli Zaretskii <eliz@gnu.org>
> Sent: Wednesday, August 2, 2023 7:50 AM
> To: Fujii Hironori <fujii.hironori@gmail.com>
> Cc: jsberg-bnl@outlook.com; 61258@debbugs.gnu.org
> Subject: Re: bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu
> use
> 
> > From: Fujii Hironori <fujii.hironori@gmail.com>
> > Date: Wed, 2 Aug 2023 07:01:27 +0900
> >
> > > Emacs built with pgtk. Editing in f90 mode, though I don't think this is
> > > important. Display is WSLg. Severe input lag, to the point off becoming
> > > unusable, gets worse with more frames (or just time?). Heavy CPU usage
> by
> > > emacs while doing anything. Problem not seen when not built with pgtk.
> >
> > I'm observing a similar high CPU usage problem with Emacs 29.1 on WSL1 and
> X server, not with
> > WSLg.
> > As suggested by
> >
> https://www.reddit.com/r/emacs/comments/urivlg/high_cpu_usage_in_wsl_with_em
> acs_29050/
> > reverting
> > https://github.com/emacs-
> mirror/emacs/commit/fa52782f5c4eaef7138534766dfc8a29465785b2
> > solves the problem for me.
> 
> Thanks, but to do anything with this report we'd need at least to
> understand what is causing the high CPU usage.  The linked Reddit post
> has a profile, but only before removing those 4 lines.  Perhaps
> comparing two profiles, before and after the change, while doing the
> same stuff in the same build of Emacs, would give us some ideas.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu use
  2023-08-02 13:00     ` J. Scott Berg
@ 2023-08-03  1:00       ` Fujii Hironori
  0 siblings, 0 replies; 9+ messages in thread
From: Fujii Hironori @ 2023-08-03  1:00 UTC (permalink / raw)
  To: 61258@debbugs.gnu.org; +Cc: Eli Zaretskii, J. Scott Berg

[-- Attachment #1: Type: text/plain, Size: 875 bytes --]

I don't understand the problem, haven't looked into it.
But, I'd like to share with you two workarounds I found out.

Workaround #2: Setting a env var EMACS_IGNORE_TIMERFD=1

Workaround #3: Applying the following patch

diff --git a/src/atimer.c b/src/atimer.c
index d07cdb82b7a..e6b0af5c01a 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -317,7 +317,7 @@ set_alarm (void)
      because the timerfd notifications aren't delivered while
      Emacs is busy, which prevents things like the hourglass
      pointer from being displayed reliably (bug#19776). */
-# ifdef CYGWIN
+# if 1 // def CYGWIN
   if (exit)
     return;
 # endif


It seems to be related to the following bugs:

#34618 - 26.1.92; timerfd interface causes slowdown on Cygwin
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34618

#51734 - 29.0.50; got slow
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51734

[-- Attachment #2: Type: text/html, Size: 1153 bytes --]

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-08-03  1:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-03 18:47 bug#61258: 29.0.60; pgtk build from git, WSLg, slow, heavy cpu use J. Scott Berg
2023-02-04  0:48 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-06 11:51   ` J. Scott Berg
2023-02-04  8:45 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-01 22:01 ` Fujii Hironori
2023-08-02  0:17   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-02 11:49   ` Eli Zaretskii
2023-08-02 13:00     ` J. Scott Berg
2023-08-03  1:00       ` Fujii Hironori

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).