From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Stephane Travostino" Newsgroups: gmane.emacs.bugs Subject: bug#72960: 31.0.50; PGTK Wayland exhibits more lag than X11 version Date: Tue, 03 Sep 2024 16:36:44 +0100 Message-ID: <6cd67964-40f2-4861-8625-a2a4cfab6655@app.fastmail.com> References: <4086d678-7a60-4b87-8c73-c5c9939f05e8@app.fastmail.com> <86mskq8dlm.fsf@gnu.org> <6985778c-712c-48ff-be6d-d5c8cbfd30f5@app.fastmail.com> <86ikvc7vcr.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31488"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72960@debbugs.gnu.org To: "Eli Zaretskii" , "Po Lu" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 04 00:19:32 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1slbs3-00083q-O1 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Sep 2024 00:19:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1slbrd-0002Co-49; Tue, 03 Sep 2024 18:19:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1slbrY-0002Bx-NY for bug-gnu-emacs@gnu.org; Tue, 03 Sep 2024 18:19:01 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1slbrY-0000cp-EI for bug-gnu-emacs@gnu.org; Tue, 03 Sep 2024 18:19:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:MIME-Version:To:Subject; bh=D6KAvqJGHqrA9UwKhIRx4SxvHcZayEV+IMcRL1bNfyw=; b=CkzfiCmcIgh4B0b74N3g7kDNnacFFdmP9faxwVjwLiUOBpw7hBsVKN8b0TrG9KP4MjN5mTcM+fTzU6V2j7qNsj91sqQB5X2G7D8v/mkh/CfGDu/Lkwst6Kn38k15Nt3PtqghKNd1rlSNhMf3y0Okbt4KJbE5ngSHoFl/WBgQ9xBG8rktUauAVvx1wZXenzfm8FtKAFINCXNq8c1NrhxNNe3jL84B58deE3NfdjyR5Z5YTPi45b+LS968VtNCvmPkNh7xlDjAMlQTCXjZRMeULsPXbwB/f1vhAwrL3uPELYMCUqrJrCC1cFSyHUWoSUPiq17tnRRHrcZPRat4v4V5WA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1slbsZ-0001nF-5M for bug-gnu-emacs@gnu.org; Tue, 03 Sep 2024 18:20:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Stephane Travostino" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Sep 2024 22:20:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72960 X-GNU-PR-Package: emacs Original-Received: via spool by 72960-submit@debbugs.gnu.org id=B72960.17254019726825 (code B ref 72960); Tue, 03 Sep 2024 22:20:03 +0000 Original-Received: (at 72960) by debbugs.gnu.org; 3 Sep 2024 22:19:32 +0000 Original-Received: from localhost ([127.0.0.1]:32947 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1slbs2-0001ly-QJ for submit@debbugs.gnu.org; Tue, 03 Sep 2024 18:19:32 -0400 Original-Received: from fout6-smtp.messagingengine.com ([103.168.172.149]:45575 helo=pfout6-smtp.messagingengine.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1slVbg-00083Q-5P for 72960@debbugs.gnu.org; Tue, 03 Sep 2024 11:38:15 -0400 Original-Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 9DDC713804D2; Tue, 3 Sep 2024 11:37:04 -0400 (EDT) Original-Received: from phl-imap-10 ([10.202.2.85]) by phl-compute-03.internal (MEProxy); Tue, 03 Sep 2024 11:37:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=combo.cc; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1725377824; x=1725464224; bh=D6KAvqJGHqrA9UwKhIRx4SxvHcZayEV+IMcRL1bNfyw=; b= UX7kQkVwpVdN3VGIkNpYRmpZQN/ZQJs/6ed9wVz2xtcDd5DxOVUJ9ultdVY0+GvR NMSkP7D3UJKYsx6gQcRW6q2O2PZBvdHb6bjl1y3nmCpveLHi2CXYv5CPZOBTsn6t WeJ0/4aJGlxTeEqb2A8oC0kr0G4Cw26Hudn9wrNApkDKa8cFJAhcgSfOqq3/fjvd OF1rY82X+9m5SY0uJAv8zhI0VJEl0hbkuFABVIsTLMDuLTRib3KU7adnqTATBSHI AiibChmu3T2GbmNB5M11nlZ7KJ9sr1f/hCcxM6NHKFLfaRVJo9fWYFwYmMYUSUH9 nEuMgAyiZUGfOutgTe/WNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1725377824; x= 1725464224; bh=D6KAvqJGHqrA9UwKhIRx4SxvHcZayEV+IMcRL1bNfyw=; b=Z dEVFtiz+KosYgH9aHcmDF+vxHaCdie3SZZlrxt9Z6GSUWiW8oSDiGT88217cfGdN WAmAXY8gsN8v836n/YbGR5J31ugtLEr9MSARGGBce45k2cVr6kFKN35+ZmIlzycj ZYpWAL+oCg0whe3ZUy+wwRX+no1u2Q97kGMvXhm/b5HTs9ts6JT69xgR8XTd9mk5 XfEBvy+hfeYvb+44Ny09pHwwI3ZSTaBt3FlyT77FmpJbzI+RSw9FTUpnAd23tBRq lTViV0uTU24GfSOFpCoG9tpKbU/+jk0gWsovt3AefOyxGMCBsXsTatCWMpApLsSf tVWRP8JR+C+j50/Ie2N9w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudehhedgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegfrhhlucfvnfffucdludehmdenucfjughrpefoggffhffvvefk jghfufgtgfesthejredtredttdenucfhrhhomhepfdfuthgvphhhrghnvgcuvfhrrghvoh hsthhinhhofdcuoehsphhhsegtohhmsghordgttgeqnecuggftrfgrthhtvghrnhepveeg geejgffhtdefkedvfedufffgieelieefhefhueehleefvddvvedtiefhgeefnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhphhestghomhgs ohdrtggtpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtth hopeejvdeliedtseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepvghlihii sehgnhhurdhorhhgpdhrtghpthhtoheplhhurghnghhruhhoseihrghhohhordgtohhm X-ME-Proxy: Feedback-ID: i4629447b:Fastmail Original-Received: by mailuser.phl.internal (Postfix, from userid 501) id 36FFD3C0066; Tue, 3 Sep 2024 11:37:04 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: <86ikvc7vcr.fsf@gnu.org> X-Mailman-Approved-At: Tue, 03 Sep 2024 18:19:29 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:291168 Archived-At: On Tue, 3 Sep 2024, at 13:52, Eli Zaretskii wrote: >> Date: Tue, 03 Sep 2024 12:27:09 +0100 >> From: "Stephane Travostino" >> Cc: 72960@debbugs.gnu.org >> >> On Mon, 2 Sep 2024, at 13:12, Stephane Travostino wrote: >> > On Mon, 2 Sep 2024, at 13:05, Eli Zaretskii wrote: >> >>> Date: Mon, 02 Sep 2024 10:18:03 +0100 >> >>> From: "Stephane Travostino" >> >>> >> >>> Heavy operations, such as scrolling back and forth in a buffer, are >> >>> noticeably laggier, for lack of better word, in the PGTK/Wayland version >> >>> than the X11, both tested on KDE in Wayland mode. >> >>> >> >>> Affects both 29.2 and the latest HEAD compiled a few days ago. >> >>> >> >>> I am unsure whether it is a KDE or Emacs problem. >> >>> >> >>> Running on an AMD RX 6800 XT graphics card on a HiDPI 4k screen at 2x >> >>> scaling. >> >> >> >> AFAIU, this is a problem with GTK input methods. From PROBLEMS: >> >> >> >> *** Emacs built with GTK lags in its response to keyboard input. >> >> This can happen when input methods are used. It happens because Emacs >> >> behaves in an unconventional way with respect to GTK input methods: it >> >> registers to receive keyboard input as unprocessed key events with >> >> metadata (as opposed to receiving them as text strings). Most GTK >> >> programs use the latter approach, so some modern input methods have >> >> bugs and misbehave when faced with the way Emacs does it. >> >> >> >> A workaround is to set GTK_IM_MODULE=none in the environment, or maybe >> >> find a different input method without these problems. >> > >> > Thank you, though without more scientific methods of measuring latency >> > I can't tell if that helps or not. >> > >> > I noticed I had pixel precision scrolling mode on and that contributed >> > a large part to that feeling of lag compared to other programs. If >> > Firefox is able to smooth scroll at 60 Hz, I would say empirically >> > Emacs PGTK would scroll at 15 Hz, making navigation in the buffer a >> > choppy affair. >> >> Update: GTK_IM_MODULE=none does not make it any less laggier. It is mostly felt in typing and editing source code, and switching to the X11 build makes it immensely snappier and doesn't feel like I'm working through a remote connection. > > Please try profiling the lagging cases with "M-x profiler", and post > the profile here. I don't know how to make a consistent test case. I have tried here to profile opening Emacs (same commit with and without PGTK) on the same 547-line Elixir file, and holding the Down key until it reaches the bottom and then back to the top of the buffer. I have (setopt scroll-conservatively 101) so after the first page the contents are continuously redrawn for every new line. The PGTK version feels like it's skipping frames while it's relatively smooth on X11: X11: 8795 86% + redisplay_internal (C function) 1141 11% + command-execute 54 0% + direnv--maybe-update-environment 49 0% + gcmh-register-idle-gc 42 0% + winner-save-old-configurations 20 0% + timer-event-handler 18 0% + ... 18 0% + jit-lock--antiblink-post-command PGTK: 9387 91% + redisplay_internal (C function) 698 6% + command-execute 19 0% + ... 19 0% + timer-event-handler 12 0% + direnv--maybe-update-environment 11 0% + winner-save-old-configurations I have run this a few times and in Wayland `redisplay_internal` takes always a few percent more time than on X11, though I am not sure these numbers can prove anything as they are quite close. Is there some kind of consistent UI benchmark I can run? The frame skipping reminds me of missed vsync deadlines one might experience in games.