[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master a06c542094: Remove redundant call to expensive function XOpenDisp
From: |
Po Lu |
Subject: |
master a06c542094: Remove redundant call to expensive function XOpenDisplay |
Date: |
Sat, 15 Oct 2022 04:25:43 -0400 (EDT) |
branch: master
commit a06c54209499c3885c13a8d3eba7798ab3f0d688
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Remove redundant call to expensive function XOpenDisplay
* src/xterm.c (x_term_init): Speed up opening Emacs over a slow
network connection by an order of magnitude on no toolkit builds
by avoiding a redundant call to XOpenDisplay.
---
src/xterm.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/xterm.c b/src/xterm.c
index 0fca9788ce..d35af7a8de 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -28527,9 +28527,10 @@ xi_check_toolkit (Display *display)
#endif
-/* Open a connection to X display DISPLAY_NAME, and return
- the structure that describes the open display.
- If we cannot contact the display, return null. */
+/* Open a connection to X display DISPLAY_NAME, and return the
+ structure that describes the open display. If obtaining the XCB
+ connection or toolkit-specific display fails, return NULL. Signal
+ an error if opening the display itself failed. */
struct x_display_info *
x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
@@ -28556,9 +28557,13 @@ x_term_init (Lisp_Object display_name, char
*xrm_option, char *resource_name)
++x_initialized;
}
- if (! x_display_ok (SSDATA (display_name)))
+#if defined USE_X_TOOLKIT || defined USE_GTK
+
+ if (!x_display_ok (SSDATA (display_name)))
error ("Display %s can't be opened", SSDATA (display_name));
+#endif
+
#ifdef USE_GTK
{
#define NUM_ARGV 10
@@ -28685,6 +28690,15 @@ x_term_init (Lisp_Object display_name, char
*xrm_option, char *resource_name)
/* Detect failure. */
if (dpy == 0)
{
+#if !defined USE_X_TOOLKIT && !defined USE_GTK
+ /* Avoid opening a display three times (once in dispextern.c
+ upon startup, once in x_display_ok, and once above) to
+ determine whether or not the display is alive on no toolkit
+ builds, where no toolkit initialization happens at all. */
+
+ error ("Display %s can't be opened", SSDATA (display_name));
+#endif
+
unblock_input ();
return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master a06c542094: Remove redundant call to expensive function XOpenDisplay,
Po Lu <=