OK, I have to be 100% sure we're not missing something here. With
stderr redirected to a file, and the following instrumentation applied::
diff --git a/src/xfns.c b/src/xfns.c
index 9e004f6a678..b4bef7f38fd 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2232,6 +2232,18 @@ x_set_name_internal (struct frame *f, Lisp_Object name)
SDATA (encoded_icon_name),
SBYTES (encoded_icon_name));
+ long long
+ current_ust (void)
+ {
+ struct timespec ts;
+
+ clock_gettime (CLOCK_MONOTONIC, &ts);
+ return ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
+ }
+
+ fprintf (stderr, "x_set_title: %s, %lld\n",
+ SSDATA (name), current_ust ());
+
if (do_free_icon_value)
xfree (icon.value);
if (do_free_text_value)
diff --git a/src/xterm.c b/src/xterm.c
index 70bcb67d80d..c7ad1bbb722 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7439,6 +7439,18 @@ show_back_buffer (struct frame *f)
swap_info.swap_action = XdbeCopied;
XdbeSwapBuffers (FRAME_X_DISPLAY (f), &swap_info, 1);
+ long long
+ current_ust (void)
+ {
+ struct timespec ts;
+
+ clock_gettime (CLOCK_MONOTONIC, &ts);
+ return ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
+ }
+
+ fprintf (stderr, "show_back_buffer: %lld\n",
+ current_ust ());
+
#if defined HAVE_XSYNC && !defined USE_GTK && defined HAVE_CLOCK_GETTIME
/* Finish the frame here. */
x_sync_update_finish (f);
do you see a significant amount of time taken between setting the title
and swapping buffers?