all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Andrea Corallo <akrl@sdf.org>
Cc: Eli Zaretskii <eliz@gnu.org>, 58634@debbugs.gnu.org
Subject: bug#58634: Long delay with blank screen whilst loading desktop at emacs startup
Date: Wed, 19 Oct 2022 19:58:36 +0000	[thread overview]
Message-ID: <Y1BW7BYf3p26s18d@ACM> (raw)
In-Reply-To: <xjfmt9r7hn9.fsf@ma.sdf.org>

Hello, Eli and Andrea.

On Wed, Oct 19, 2022 at 19:11:38 +0000, Andrea Corallo wrote:
> Eli Zaretskii <eliz@gnu.org> writes:

> >> Date: Wed, 19 Oct 2022 13:28:42 +0000
> >> From: Alan Mackenzie <acm@muc.de>

> >> In my current desktop file, I have 166 buffers.  I'm using an up to date
> >> Emacs 29.

> >> On loading this desktop into emacs -nw on X Windows, or into a linux
> >> console, it takes a long time to load, around 28 seconds.  Of that time,
> >> my terminal window/screen is entirely blank for around 18 seconds, with
> >> not even a mode line being displayed.

> > And nothing in the echo-area, either?

Nothing in the echo-area, no.

> >> Doing the same in a GUI run on X also takes around 28 seconds to load,
> >> but during that time, random buffers are displayed on the screen,
> >> complete with mode line.

> >> I think the native compiler is running in the background during this 28
> >> seconds, and thus contributes to the relatively long start up time.

> > To test this hypothesis, leave Emacs alone running until
> > list-processes shows an empty list, then restart Emacs.  This time,
> > you should not see the delay due to native compilation, so if there
> > still is a delay, it is unlikely to be due to native compilation.

I did this, and there was still a delay.  So I'm pretty sure it's nothing
to do with native compilation, now.

> > In any case, you should be able to see whether it's native compilation
> > by watching the emacs --batch processes that run on your system during
> > that time.

> Yes totally agree, listing processes is the quickest way to confirm this
> hypothesis.

> Alan please let us know.

It's nothing to do with native compilation.  Apologies.

What I did do was insert debugging code which prints an extra . for each
loaded file.  More precisely:

diff --git a/lisp/desktop.el b/lisp/desktop.el
index ef73bc596d..554e82ab40 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -1599,6 +1607,10 @@ desktop-create-buffer
            (setq desktop-buffer-ok-count (1+ desktop-buffer-ok-count))
          (setq desktop-buffer-fail-count (1+ desktop-buffer-fail-count))
          (setq result nil))
+        (let ((buffer-total-count (+ desktop-buffer-ok-count
+                                     desktop-buffer-fail-count)))
+          (message (concat "Restoring desktop..."
+                           (make-string buffer-total-count ?.))))
        ;; Restore buffer list order with new buffer at end. Don't change
        ;; the order for old desktop files (old desktop module behavior).
        (unless (< desktop-file-version 206)

On my linux console, this displays a few buffers (out of ~166) in
addition to the dots in the echo area.

I have a theory.  The function desktop-restore-file-buffer visits a file
with find-file-noselect, then calls switch-to-buffer on it.  (This is the
interactive command on C-x b.)  In earlier times, there would be a delay
in visiting the next file, and in this delay redisplay would happen.  The
user would thus see a sequence of short displays of his files being
loaded.  Nowadays, the time to visit a file is so short that redisplay
never registers a delay, and so doesn't redisplay.  But with something
slowing the processing down a little (outputting "Restoring
desktop......", for example), the OS's file system goes to sleep, and
takes long enough to wake up for redisplay to trigger.  Or something like
that.

What do you think?

>   Andrea

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2022-10-19 19:58 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 13:28 bug#58634: Long delay with blank screen whilst loading desktop at emacs startup Alan Mackenzie
2022-10-19 15:49 ` Eli Zaretskii
2022-10-19 19:11   ` Andrea Corallo
2022-10-19 19:58     ` Alan Mackenzie [this message]
2022-10-20  5:20       ` Eli Zaretskii
2022-10-20 10:55         ` Alan Mackenzie
2022-10-20 13:07           ` Eli Zaretskii
2022-10-20 15:28             ` Alan Mackenzie
2022-10-20 16:28               ` Eli Zaretskii
2022-10-21  8:59                 ` Alan Mackenzie
2022-10-21 11:28                   ` Eli Zaretskii
2022-10-21 12:40                     ` Alan Mackenzie
2022-10-21 13:22                       ` Eli Zaretskii
2022-10-21 14:15                         ` Alan Mackenzie
2022-10-21 15:23                           ` Eli Zaretskii
2022-10-21 15:42                             ` Alan Mackenzie
2022-10-21 15:57                               ` Eli Zaretskii
2022-10-21 17:15                                 ` Alan Mackenzie
2022-10-21 18:12                                   ` Eli Zaretskii
2022-10-21 19:01                                     ` Alan Mackenzie
2022-10-21 19:14                                       ` Eli Zaretskii
2022-10-21 20:11                                         ` Alan Mackenzie
2022-10-22  6:26                                           ` Eli Zaretskii
2022-10-22 12:20                                             ` Alan Mackenzie
2022-10-22 13:11                                               ` Eli Zaretskii
2022-10-23 15:22                                                 ` Alan Mackenzie
2022-10-23 16:23                                                   ` Eli Zaretskii
2022-10-23 18:58                                                     ` Alan Mackenzie
2022-10-23 19:11                                                       ` Eli Zaretskii
2022-10-26 16:35                                                         ` Alan Mackenzie
2022-10-26 16:38                                                           ` Eli Zaretskii
2022-10-26 19:39                                                           ` Stefan Kangas
2022-10-27  5:19                                                             ` Eli Zaretskii
2022-10-21 19:09                       ` Stefan Kangas
2022-10-22 17:46                     ` Juri Linkov
2022-10-22 18:33                       ` 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=Y1BW7BYf3p26s18d@ACM \
    --to=acm@muc.de \
    --cc=58634@debbugs.gnu.org \
    --cc=akrl@sdf.org \
    --cc=eliz@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 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.