Subject: bug#17648: closed (Re: emacs -nw FILE incurs 2-second wait before displaying anything)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 13 Jun 2014 15:08:03 +0000

Your bug report

#17607: 24.4.50; regression: emacsclient under screen (1) slow for some values of TERM

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
17607: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17607
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: emacs -nw FILE incurs 2-second wait before displaying anything
From: Stefan Monnier <[email-masked]>
To: Jim Meyering <[email-masked]>
Cc: [email-masked]
Date: Fri, 13 Jun 2014 11:07:31 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

>> Does the patch below fix the 2-second wait?
> Yes, it does.  Thank you!

Thanks, installed into emacs-24.

        Stefan

Subject: 24.4.50; regression: emacsclient under screen (1) slow for some values of TERM
From: Gregor Zattler <[email-masked]>
To: [email-masked]
Date: Sat, 31 May 2014 02:18:00 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Dear emacs developers,

under screen with emacs from repo

emacsclient -t <some-filename>

almost instantaneously shows the scratch buffer (or some other
last used buffer), then for 2 secs nothing happens, then the
window shows the buffer which corresponds to some-file-name and
one is able to work with it.

This happens for some values of TERM.

recipe:

emacs-snapshot -Q --daemon

now do

/usr/bin/time screen -m -c /dev/null  -T $TERMINALNAME  sh -c "emacsclient.emacs-snapshot -n -t /tmp/emacsslow/AA${RANDOM}${RANDOM}BB ; emacsclient.emacs-snapshot --eval '(server-edit)'"

for different values of TERMINALNAME

Here is a sorted list of elapsed times for terminfo definitions
from my debian testing system (the elapsed times in this list are
the median of 11 rounds with each terminfo definiton):

0:00.05elapsed screen2
0:00.05elapsed screen3
0:00.05elapsed screen.Eterm
0:00.05elapsed screen.gnome
0:00.05elapsed screen.konsole
0:00.05elapsed screen.linux
0:00.05elapsed screen.mlterm
0:00.05elapsed screen.mrxvt
0:00.05elapsed screen.rxvt
0:00.05elapsed screen.teraterm
0:00.05elapsed screen.vte
0:00.05elapsed screen.xterm-new
0:00.05elapsed screen.xterm-r6

some of them are *much* slower:
0:02.06elapsed screen-16color
0:02.07elapsed screen-16color-bce
0:02.07elapsed screen-16color-s
0:02.07elapsed screen-bce.Eterm
0:02.07elapsed screen-bce.gnome
0:02.07elapsed screen-bce.konsole
0:02.07elapsed screen-bce.linux
0:02.07elapsed screen-bce.mlterm
0:02.07elapsed screen-bce.mrxvt
0:02.07elapsed screen-bce.rxvt
0:02.08elapsed screen-256color-s
0:02.09elapsed screen-256c-bce-s --> screen-256color-bce-s

Sadly I use the last one, which is a link to the actual terminfo
file since screen (1) does not accept TERM values with a length
of more then 20 characters.

I did the same timing tests with emacs24 as packaged for debian
testing:

0:00.02elapsed screen3
0:00.02elapsed screen.mrxvt
0:00.03elapsed screen-16color
0:00.03elapsed screen-16color-bce
0:00.03elapsed screen-16color-s
0:00.03elapsed screen2
0:00.03elapsed screen-bce.Eterm
0:00.03elapsed screen-bce.gnome
0:00.03elapsed screen-bce.konsole
0:00.03elapsed screen-bce.linux
0:00.03elapsed screen-bce.mlterm
0:00.03elapsed screen-bce.mrxvt
0:00.03elapsed screen-bce.rxvt
0:00.03elapsed screen.gnome
0:00.03elapsed screen.konsole
0:00.03elapsed screen.linux
0:00.03elapsed screen.mlterm
0:00.03elapsed screen.rxvt
0:00.03elapsed screen.teraterm
0:00.03elapsed screen.vte
0:00.03elapsed screen.xterm-new
0:00.04elapsed screen-256c-bce-s
0:00.04elapsed screen-256color-s
0:00.04elapsed screen.xterm-r6
0:00.10elapsed screen.Eterm

There is no such 2 secs delay.

I did a git bisect on the repo and this produced:

6607a79c6e7c7554059557c0db78c26c57314f24 is the first bad commit
commit 6607a79c6e7c7554059557c0db78c26c57314f24
Author: Daniel Colascione <[email-masked]>
Date:   Thu Apr 17 00:54:23 2014 -0700

    2014-04-17  Daniel Colascione  <[email-masked]>

        Add support for bracketed paste mode; add infrastructure for
        managing terminal mode enabling and disabling automatically.

        * xt-mouse.el:
        (xterm-mouse-mode): Simplify.
        (xterm-mouse-tracking-enable-sequence)
        (xterm-mouse-tracking-disable-sequence): New constants.
        (turn-on-xterm-mouse-tracking-on-terminal)
        (turn-off-xterm-mouse-tracking-on-terminal): Use
        tty-mode-set-strings and tty-mode-reset-strings terminal
        parameters instead of random hooks.
        (turn-on-xterm-mouse-tracking)
        (turn-off-xterm-mouse-tracking): Delete.

        * term/xterm.el (xterm-extra-capabilities): Fix bitrotted comment.
        (xterm-paste-ending-sequence): New constant.
        (xterm-paste): New command used for bracketed paste support.

        (xterm-modify-other-keys-terminal-list): Delete obsolete variable.
        (terminal-init-xterm-bracketed-paste-mode): New function.
        (terminal-init-xterm): Call it.
        (terminal-init-xterm-modify-other-keys): Use tty-mode-set-strings
        and tty-mode-reset-strings instead of random hooks.
        (xterm-turn-on-modify-other-keys)
        (xterm-turn-off-modify-other-keys)
        (xterm-remove-modify-other-keys): Delete obsolete functions.

        * term/screen.el: Rewrite to just use the xterm code.  Add
        copyright notice.  Mention tmux.

:040000 040000 35e7957f61e4d66ebd209cd1c4e866a28d4b2530 ab84f10010ef069579268a06a8cb87297a99222f M      doc
:040000 040000 6e356fc3442cded91abe85539d87c010a5b55b74 97ed2cb729e1981da13e3087f31ca1d889d207f5 M      etc
:040000 040000 1f0fa9c7b097af1630c809920c763294996bc9e1 e2cb31100399d2a62f34c29014f588c097033f8d M      lisp
:040000 040000 502e344d50623e95ecd35483334810ab76f9f5da f2e77d45d90ad1964f395e75cbd318ee01e4b7a3 M      src
bisect run success

0 grfz@boo:~/src/emacs$ git bisect log
git bisect start
# bad: [70ae6e9f3ca829e4a22290a8f2434343e2f0e127] * admin/notes/changelogs: Mention `quoting'.
git bisect bad 70ae6e9f3ca829e4a22290a8f2434343e2f0e127
# good: [87cc4be37367f4039a1fb6bda8ba681bb279475f] Bump version to 24.3.91
git bisect good 87cc4be37367f4039a1fb6bda8ba681bb279475f
# bad: [83e103c61b9d775709624a44e7ed5b20ba44847d] Improve Scheme font-locking for (define ((foo ...) ...) ...).
git bisect bad 83e103c61b9d775709624a44e7ed5b20ba44847d
# good: [5910501252ec0067857e36c1d73e7b522d83b861] * emacs-lisp/eldoc.el (eldoc-print-current-symbol-info): Refactor out eldoc-documentation-function-default.
(eldoc-documentation-function-default): New function. (eldoc-documentation-function): Change value.
git bisect good 5910501252ec0067857e36c1d73e7b522d83b861
# good: [f0f301dd19212bf133aacd7fd592e126958309d8] Merge from emacs-24; up to r116940
git bisect good f0f301dd19212bf133aacd7fd592e126958309d8
# bad: [069e400fbf7d0e404438a922c9f5839b1d4902da] Tweak documentation for previous change
git bisect bad 069e400fbf7d0e404438a922c9f5839b1d4902da
# good: [6f100a7a58857ce2838a11eec596073837ba7858] Remove DATA_SEG_BITS.
git bisect good 6f100a7a58857ce2838a11eec596073837ba7858
# good: [085874f070af05df7a80b8e10cb5f88696bd685e] * GNUmakefile: Speed up 'make bootstrap' in fresh checkout.
git bisect good 085874f070af05df7a80b8e10cb5f88696bd685e
# bad: [ed507155bec59e1dd1844b4593d75aec1906b594] Merge from emacs-24; up to r116982
git bisect bad ed507155bec59e1dd1844b4593d75aec1906b594
# bad: [5c1915d10b3716879785fe49f5cfe20beeb37090] * term.c (tty_send_additional_strings): No need to fflush here,
git bisect bad 5c1915d10b3716879785fe49f5cfe20beeb37090
# bad: [6607a79c6e7c7554059557c0db78c26c57314f24] 2014-04-17  Daniel Colascione  <[email-masked]>
git bisect bad 6607a79c6e7c7554059557c0db78c26c57314f24
# first bad commit: [6607a79c6e7c7554059557c0db78c26c57314f24] 2014-04-17  Daniel Colascione  <[email-masked]>

I have no idea if or how this is related to the problem at hand,
but screen.el was changed, therefore I hope this info helps.

I wished, emacsclient would open files be fast again.

I would be happy to answer questions or do some testing
if someone provides me with instruction.

Thanks for your attention, Gregor