all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 61779@debbugs.gnu.org
Subject: bug#61779: 30.0.50; excessive redisplay when the mini window is active
Date: Sat, 25 Feb 2023 17:37:14 +0800	[thread overview]
Message-ID: <87v8jq2iid.fsf@yahoo.com> (raw)
In-Reply-To: <83ilfqkv1o.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 25 Feb 2023 10:29:07 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Sat, 25 Feb 2023 14:16:37 +0800
>> From:  Po Lu via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> 
>> 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''?
>
> This is okay for master, thanks.

The comment that was there still makes me uncomfortable, so:

> Btw, the code which tests MINI_WINDOW_P here:
>
>> 	  && (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).
>
> is very old, dating back to the initial revision of xdisp.c before the
> Emacs 21 display engine changes, so maybe we should try removing that
> instead (assuming that it is related to the more general change
> regarding the cursor you want to install).

I guess that's the better idea, since it's the only reasonable way I
found to make update_window be called extremely often without any
changes actually happening.





      reply	other threads:[~2023-02-25  9:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <878rgm46d6.fsf.ref@yahoo.com>
2023-02-25  6:16 ` bug#61779: 30.0.50; excessive redisplay when the mini window is active Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-25  8:29   ` Eli Zaretskii
2023-02-25  9:37     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8jq2iid.fsf@yahoo.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=61779@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.