From: Michael Stapelberg <stapelberg+emacs@google.com>
To: emacs-devel@gnu.org
Subject: x_display_ok() is slow over using SSH X11 forwarding
Date: Wed, 2 Sep 2020 15:48:40 +0200 [thread overview]
Message-ID: <CAH9Oa-a2HWmsxuA7qto2=V03tj-VY=KyhE2bg6VNwLizXiKq+A@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1771 bytes --]
Hey,
Like undoubtedly many of you, I started Working From Home a while ago and
will continue to do so for some time.
I am using Emacs over SSH’s X11 forwarding, which—for various reasons—is
the best setup for me, and yes, I have already tried numerous others
(TRAMP, remote desktop, nx, xpra, …).
The one issue I have with my setup is that Emacs takes a noticeably long
time to open a new frame (X11 window).
I have discovered that Emacs opens 4 (!) X11 connections when a new Emacs
process opens a frame: https://twitter.com/zekjur/status/1293892602274746370
I then measured how long opening an X11 connection takes, and found that
when using SSH X11 forwarding, opening an X11 connection is really slow
(≈120ms) compared to locally (≈0.5ms):
https://twitter.com/zekjur/status/1296763221936939010
It turns out that 2 of the 4 connections are made by x_display_ok(), which
can easily be short-circuited to verify:
https://twitter.com/zekjur/status/1298002575267110919.
Setting NO_AT_BRIDGE=1 removes the third connection.
Now, entirely short-circuiting that function is a big hammer, and probably
we don’t want to break existing users of x_display_ok(), but I do wonder
what the best way to remove these unnecessary connection attempts is?
From a high-level perspective, the current behavior is unnecessary because:
1. If the X11 $DISPLAY variable is not okay, I’ll get an error message
anyway.
2. Just because $DISPLAY worked at the time of check doesn’t mean it’ll
work at time of use.
3. Even if checking is desired, there is no need to check twice during
startup, and we should retain the connection used for checking so that we
don’t need to connect over and over.
Any thoughts?
Thanks,
[-- Attachment #2: Type: text/html, Size: 2269 bytes --]
next reply other threads:[~2020-09-02 13:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-02 13:48 Michael Stapelberg [this message]
2020-09-02 14:56 ` x_display_ok() is slow over using SSH X11 forwarding Robert Pluim
2020-12-17 15:44 ` Michael Stapelberg
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH9Oa-a2HWmsxuA7qto2=V03tj-VY=KyhE2bg6VNwLizXiKq+A@mail.gmail.com' \
--to=stapelberg+emacs@google.com \
--cc=emacs-devel@gnu.org \
/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 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).