From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61779: 30.0.50; excessive redisplay when the mini window is active Date: Sat, 25 Feb 2023 14:16:37 +0800 Message-ID: <878rgm46d6.fsf@yahoo.com> References: <878rgm46d6.fsf.ref@yahoo.com> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25916"; mail-complaints-to="usenet@ciao.gmane.io" To: 61779@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 25 07:20:26 2023 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 1pVnv0-0006Xl-2x for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Feb 2023 07:20:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVnui-0006Lt-7T; Sat, 25 Feb 2023 01:20:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVnuc-0006LB-JI for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 01:20:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVnuc-0003Nx-8k for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 01:20:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pVnub-00011e-Vs for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 01:20:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Feb 2023 06:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61779 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16773059583873 (code B ref -1); Sat, 25 Feb 2023 06:20:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Feb 2023 06:19:18 +0000 Original-Received: from localhost ([127.0.0.1]:38849 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVntt-00010P-OZ for submit@debbugs.gnu.org; Sat, 25 Feb 2023 01:19:18 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:46882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVntr-00010B-QN for submit@debbugs.gnu.org; Sat, 25 Feb 2023 01:19:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVntm-0006GP-L7 for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 01:19:15 -0500 Original-Received: from sonic314-49.consmr.mail.ne1.yahoo.com ([66.163.189.175]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVntj-0003J9-W1 for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 01:19:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1677305943; bh=qqSI2dk88nGkNtH+bzp+xJq0IwV+JMB0Rl6CB6xaH9o=; h=From:To:Subject:Date:References:From:Subject:Reply-To; b=lxLy/9MXzT0fUFKf0GIVysabhGf7FRlbg1FS4CQe549Fxyaje6UZ20fjznQ0Q5/MJqeAW8Y/Pts7Cu0mMuDWgN/aCDZvBjReLvLRyuObZZxX5Qne4/fM8vdR01s2ujxyM934jW7fuEbmwP8pNBNMHSh6cFpmoeu+RY6LLhLyUoUeCldBc/1LUNhPE4fnVryZF+kpk+dNaB3y3OTXKg20HMLxf/fIv58IdpocV2heuetMQE1wbfpC5FRhtC70FlwiIQWMIfGuwibOY9B1tkoJyZg1YrRSxaOownBi2zD++kBUovckxpFpxjT2Of9P2jgPoAQBKEffrO4Gx/HE2KX0wA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1677305943; bh=ktOBVpMF4+jz5ik2E5HUCQJmkJpiqZV0mxy/ty5qebG=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=oR8HIYK0hpYCA4tt+QhWLXTSfo1f3gQ9xlklbRtLUJfzlKLWvoxHecuRXnlPWYdJ55/sDtCklr7cIaSNKJwGdhr20jUJrISSQvZl3xLrsx27N2D9jE9OYCuDiRXp5XZ2TI0FPaE3GUVzjmBX2c2TjQZJsoKJUv4N42BBDwbQ0PycdqvyCjTORXHlpWCXi7guSlQFwbGDMrIYpstaIAzaZiUxGaMl7REbHWoxZgoty3WzoWPX7wAO4OGGTBujXlfihZC+u6/p2RyjwGFF+1B26KjPALpJ5mknqLYAwUqngXA651Fv/ltr2pmDIl2yhI9RxrmrG7MPnugTnd92Pxr3OQ== X-YMail-OSG: X2IKISYVM1kxDGipIWVIVOaqjcF.5DF_L5bNoRV9rM_Qe.HURF848oYtmsotOFp VDUTbE0uTfHIXfh6uChHLeO554eDzRnksLrEq34520LxSb0vzwzYaM1yw_tdEMTi3s5RwX86MfHM 9N197Eg8UY8bxaPhM9xQAZ8301mECJSrGL_qd9sncOm.h7VJVv6uvq_FyowKPiVFqVAwpW2IY.Y5 Sd2j6xJKxYqBkfIe0oHHbRrrHH8h7eTu5Lz3k9xydFDyQ1DiPGwMyq9vM6Pt7TazuCgcsOzTMscT 9sr7bbHcx48VvXknirgz7p8j_Si74rVhOoDHjJpRb8UxqFfayuMkRsJnE7rdF1Lz0CuDSlzRQjQc XIw1gLmEeMx03lAEXMIIoMLynhRA85ensgAxS8rbkwHGveIPhHl8wPy77iiW1aUE_7C1VHRQlhU_ itIrF0OLHAM3Sr4PbaXypsw9UB7OXc1CPOmU87e_H9N4.cGh1wYHYgiBD0KjXbGuAXmtZUBmt8DZ CY6MrJ24YsAg6JEdfX_qe5VjWhVaKLc.9C3xAbmuqhicd4zZoI5TZhyy4mJIAo4WKusNlkJmKNwp k.uXJbfcYSvGasmCQWnnECf1_G_1yF4xLNyw0_rISvqZmh3lVpA20QSTV72RjAWarSW9h1oq1KHf RkBRnpcpG1Ef7Sth0vcxarwkUunHAEVxBmZyeObnXHUIzodwaR5yP1aF41EwYsnperxAhxcV7LE0 ze3jJ7.miUagVuGKtYX9eyfn4QJ2D_A1flq2m0Xt1TxD_4xWMHam4GY0qzBqudVkDkzkgG59wRyE asWciTHejGu6I.OH2UOMesPN1nnNDJLUFL.dvH7yqN X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.ne1.yahoo.com with HTTP; Sat, 25 Feb 2023 06:19:03 +0000 Original-Received: by hermes--production-sg3-9fc5746c8-nc5k6 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 7e9695a441c5a7248e88652e28574e3a; Sat, 25 Feb 2023 06:17:00 +0000 (UTC) X-Mailer: WebService/1.1.21221 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.189.175; envelope-from=luangruo@yahoo.com; helo=sonic314-49.consmr.mail.ne1.yahoo.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-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:256686 Archived-At: For some reason redisplay_internal will always update the mini window even if its buffer contents have not changed. I guess there is probably a missing optimization wrt to updating the echo area contents, and window_outdated does not take the echo area message into account: && (CHARPOS (tlbufpos) == ZV || FETCH_BYTE (BYTEPOS (tlbufpos)) == '\n')) /* Former continuation line has disappeared by becoming empty. */ goto cancel; else if (window_outdated (w) || MINI_WINDOW_P (w)) <============== { /* We have to handle the case of continuation around a wide-column character (see the comment in indent.c around line 1340). I am not sure that is why, however, so I can't just change that. Anyway, update_window_line does not draw anything since the contents of the glyph row do not change after redisplay, so that part is fine. The problem is that the redisplay will lead to update_window being called, and gui_update_window_end will always call display_and_set_cursor afterwards to display the cursor, which is not okay, as it generates a lot of X protocol traffic when redisplay is called and redisplays the mini-window. Now add to that a process generating a lot of output, and by doing so, calls to redisplay_preserve_echo_area, and you have an absurd number of X requests, enough to saturate any reasonable network connection. Here is a patch to resolve the problem by not redrawing the cursor when Emacs knows it is already there. I've not seen any ill effects so far, but the comment originally there seems to know better, so what are the cases where ``phys_cursor_on_p is 1 but the cursor has been erased''? Thanks. diff --git a/src/xdisp.c b/src/xdisp.c index c5c4321af77..39568bb6b1f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -33333,12 +33333,21 @@ display_and_set_cursor (struct window *w, bool on, && new_cursor_width != w->phys_cursor_width))) erase_phys_cursor (w); - /* Don't check phys_cursor_on_p here because that flag is only set - to false in some cases where we know that the cursor has been - completely erased, to avoid the extra work of erasing the cursor - twice. In other words, phys_cursor_on_p can be true and the cursor - still not be visible, or it has only been partly erased. */ - if (on) + /* XXX: this previously read: + + Don't check phys_cursor_on_p here because that flag is only set + to false in some cases where we know that the cursor has been + completely erased, to avoid the extra work of erasing the + cursor twice. In other words, phys_cursor_on_p can be true and + the cursor still not be visible, or it has only been partly + erased. + + However, not checking this flag results in too much cursor redraw + if the mini-window is being redisplayed, since process output + results in calls to redisplay_internal, which always redisplays + the mini window regardless of whether or not its contents have + changed. */ + if (on && !w->phys_cursor_on_p) { w->phys_cursor_ascent = glyph_row->ascent; w->phys_cursor_height = glyph_row->height;