all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ken Raeburn <raeburn@permabit.com>
Cc: 11822@debbugs.gnu.org
Subject: bug#11822: 24.1; emacsclient terminal mode captures escape characters as text
Date: Thu, 10 Sep 2015 18:36:07 +0300	[thread overview]
Message-ID: <83bnda5lso.fsf@gnu.org> (raw)
In-Reply-To: <6e613irc91.fsf@just-testing.permabit.com>

> From: Ken Raeburn <raeburn@permabit.com>
> Cc: 11822@debbugs.gnu.org
> Date: Thu, 10 Sep 2015 02:59:06 -0400
> 
> > I don't think the idea of holding off some display updates for
> > whatever reasons will fly, because users rightfully expect the display
> > to be up to date, unless Emacs is busy computing something.
> 
> I didn't mean having them seconds or minutes out of date. What I'm
> thinking of -- assuming for the sake of argument that we're still
> concerned about types of changes that'll still require changes on
> multiple frames even after the global-variable issues are addressed,
> like changing the default face's foreground color -- would be something
> like updating faces and then content on one frame, then going on to the
> next and updating faces and then content, but preempting the rest ASAP
> if user input is received. If recompute_basic_faces is called, since it
> triggers a lot of round trips, at least one or two possible preemption
> points in the middle of that sequence.

We had this ability in the past, but we all but deleted it, as it
seemed not to make redisplay more responsive.  The comment which was
left when this was done says:

  /* Contrary to expectations, a value of "false" can be detrimental to
     responsiveness since aborting a redisplay throws away some of the
     work already performed.  It's usually more efficient (and gives
     more prompt feedback to the user) to let the redisplay terminate,
     and just completely skip the next command's redisplay (which is
     done regardless of this setting if there's pending input at the
     beginning of the next redisplay).  */

But it could be that we didn't look at the effect of this when frames
are displayed via X over slow networks.  So please try experimenting
with an Emacs before the deletion (I think 24.4 is old enough), and
see if setting redisplay-dont-pause to nil helps in your case.  If it
doesn't, then what you suggest above is probably not an idea that will
yield tangible benefits.

> >> Would changing sizes for a face cause the face to be recomputed from
> >> scratch?
> >
> > It doesn't in my testing (I tried "C-x C-+").  You can easily try that
> > yourself: put a breakpoint on recompute_basic_faces, and see if it
> > breaks when you change the face size.
> 
> I tried it in the scratch buffer in a new Emacs process. It doesn't call
> recompute_basic_faces, but it did call realize_face twice, and
> XParseColor and x_alloc_nearest_color_1 each four times. So that's eight
> round trips that seem unnecessary as we should already have the color
> definitions and allocated color cells.

For how many frames were XParseColor and x_alloc_nearest_color_1
called?  If only for the single frame where you've changed the face,
then it's expected.

If you are suggesting to be more selective wrt what exactly needs to
be recomputed during face update, then this will need some analysis
regarding which parts are more expensive than others, and introduction
of corresponding flags to signal which face aspects need to be
recomputed.  Assuming this is even possible without a more or less
complete rewrite of face-related code (which currently just throws
away a face and realizes it anew), the relative cost (in terms of
time) of recomputing each aspects will most probably be different for
different display back-ends, perhaps even for different network
bandwidths.  Someone™ should do this research and publish the results,
before we could start designing a good solution.

> > Given this general description, what would "lower priority" mean in
> > practice?
> 
> Reorder the frame traversal.

Since the goal is to limit redisplay to a single frame, the current
one, I think this is a moot point.

> > My reading of the discussion and your backtraces indicate that all of
> > that stems from a single problem: when we create or update faces, we
> > set a global flag that causes faces to be recomputed on all frames.
> > This then snowballs into the need to reload colors and redraw all
> > frames.
> 
> I think that's the worst part for my new-frame-with-multiple-displays
> case, but I don't think it's the only area of the code that could be
> improved.

We should see about that once the global face recalculation is gone.

> I took a look at the calls to x_alloc_nearest_color_1. In creating an
> initial frame with "emacs -Q", I get over two hundred calls, and every
> one requires a round-trip to the server. But there were only 13 distinct
> RGB color values passed. The most popular values passed were these:
> 
>      88 x_alloc_nearest_color_1(0000/0000/0000) (white)
>      71 x_alloc_nearest_color_1(ffff/ffff/ffff) (black)
>      15 x_alloc_nearest_color_1(bfbf/bfbf/bfbf) (grey75)
> 
> Then there's XParseColor; over 2300 calls, but only about 9% require
> round-trips to the server, the rest using the "#RRGGBB" syntax that gets
> parsed locally. I haven't traced which part of the program accounts for
> what fraction of the calls.

Once again, it is necessary to figure out which portions of these
calls is on behalf of frames other than the one being created.  Those
calls should all but go away after the global effect of face updating
is eliminated.  Only after that we will see how much of this problem
remains.

> Eliminating unnecessary cache clearing might reduce these, maybe by a
> factor of two or more, but that's still excessive

What is the estimation of "factor of two or more" is based on?  Why
not by an order of magnitude, for example?

> Now, if instead we had just *one* call to XAllocNamedColor for
> "white", and one for "black", etc....

Why do you think we will have more than that?






  reply	other threads:[~2015-09-10 15:36 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-30  0:08 bug#11822: 24.1; emacsclient terminal mode captures escape characters as text Ken Raeburn
2012-06-30  5:55 ` Eli Zaretskii
2012-07-31 21:06   ` Ken Raeburn
2012-08-08  3:13     ` Ken Raeburn
2012-08-08  4:52       ` Dan Nicolaescu
2012-08-08  9:26         ` Ken Raeburn
2012-08-09 21:12           ` Ken Raeburn
2012-08-10  6:16             ` Eli Zaretskii
2012-08-10  7:27               ` Ken Raeburn
2012-08-10  7:46                 ` Eli Zaretskii
2012-08-10  8:08                   ` Eli Zaretskii
2015-09-07 21:09                     ` Ken Raeburn
2015-09-08  1:29                       ` Stefan Monnier
2015-09-08  4:29                         ` Eli Zaretskii
2015-09-08  6:53                         ` Ken Raeburn
2015-09-08 13:03                           ` Stefan Monnier
2015-09-08 13:11                           ` Stefan Monnier
2015-09-08 17:21                             ` Eli Zaretskii
2015-09-08  4:48                       ` Eli Zaretskii
2015-09-08 10:15                         ` Ken Raeburn
2015-09-08 13:35                           ` Stefan Monnier
2015-09-08 17:33                           ` Eli Zaretskii
2015-09-08 19:54                             ` Ken Raeburn
2015-09-09 14:16                               ` Eli Zaretskii
2015-09-10  6:59                                 ` Ken Raeburn
2015-09-10 15:36                                   ` Eli Zaretskii [this message]
2015-09-10 17:56                                     ` Stefan Monnier
2015-09-10 18:06                                       ` Eli Zaretskii
2015-09-11 12:56                                         ` Stefan Monnier
2015-09-11 13:53                                           ` Eli Zaretskii
2015-09-11 16:53                                             ` Stefan Monnier
2015-09-11  6:54                                     ` Ken Raeburn
2015-09-11  7:22                                       ` Eli Zaretskii
2015-09-11 23:11                                         ` Ken Raeburn
2015-09-12  0:51                                           ` Stefan Monnier
2015-09-12  1:34                                             ` Ken Raeburn
2015-09-15 14:29                                             ` Eli Zaretskii
2015-09-15 16:14                                               ` Stefan Monnier
2015-09-18 14:19                                                 ` Eli Zaretskii
2015-09-21  9:23                                                   ` Ken Raeburn
2015-09-21  9:44                                                     ` Eli Zaretskii
2015-09-23 17:27                                                       ` Ken Raeburn
2015-09-23 18:04                                                         ` martin rudalics
2015-09-23 20:59                                                           ` Ken Raeburn
2015-09-23 19:17                                                         ` Eli Zaretskii
2015-09-24  8:52                                                           ` Ken Raeburn
2015-09-24 18:46                                                             ` Eli Zaretskii
2015-09-24 20:08                                                               ` Ken Raeburn
2015-09-25  6:49                                                                 ` Eli Zaretskii
2015-09-25 12:07                                                                   ` Stefan Monnier
2015-09-26  7:01                                                                   ` Eli Zaretskii
2015-09-25  6:50                                                             ` Eli Zaretskii
2015-09-25 12:09                                                               ` Stefan Monnier
2015-09-25 13:29                                                                 ` Eli Zaretskii
2015-09-25 15:18                                                                   ` Stefan Monnier
2015-09-12  7:30                                           ` Eli Zaretskii
2015-09-11 13:39                                       ` Stefan Monnier
2015-09-11 14:01                                         ` Eli Zaretskii
2015-09-08 13:22                         ` Stefan Monnier
2015-09-08 17:25                           ` Eli Zaretskii
2015-09-08 18:52                             ` Stefan Monnier
2015-09-08 19:08                               ` Eli Zaretskii
2015-09-08 20:37                                 ` Stefan Monnier
2015-09-08 17:36                         ` Eli Zaretskii

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=83bnda5lso.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=11822@debbugs.gnu.org \
    --cc=raeburn@permabit.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.