Subject: bug#13337: closed (Re: bug#13337: 24.3.50; Slow display in term mode (M-x term))

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 03 Jan 2013 18:33:02 +0000

Your bug report

#13337: 24.3.50; Slow display in term mode (M-x 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].

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

Subject: Re: bug#13337: 24.3.50; Slow display in term mode (M-x term)
From: Glenn Morris <[email-masked]>
To: [email-masked]
Date: Thu, 03 Jan 2013 13:32:33 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 24.2.92

Thanks for checking. Applied to emacs-24 branch, should show up in trunk
in ~ 1 week or less.

Subject: 24.3.50; Slow display in term mode (M-x term)
From: Øyvind Stegard <[email-masked]>
To: [email-masked]
Date: Wed, 02 Jan 2013 15:10:09 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello bug list,

Display for term emulation mode is very slow in recent emacs snapshot
version.

Reproduce:
0. $ emacs -Q -nw
1. M-x term <RET> <RET> (use default /bin/bash shell)
2. Run a `find /' in terminal. (Or anything really. Even typing feels
   sluggish.)

Emacs then uses 90–100% CPU and output from running command is processed
slowly. The issue is likely not related to X, since it is reproducable
also when running Emacs in gnome-terminal with `emacs -Q -nw'. Display
seems to speed up significantly when selecting another window instead
(for instance, switch from term window to minibuffer with C-c M-x ...
while `find /' is running to observe difference).

The *Messages* buffer is flooded with the following when term window is
selected (har cursor) and at the same time output is produced:
  Invalid face attribute :foreground nil
  Invalid face attribute :background nil
  Invalid face attribute :foreground nil
  Invalid face attribute :background nil
  Invalid face attribute :foreground nil
  Invalid face attribute :background nil

Here is some CPU profiling output while find command is running and term
window is selected, obtained with M-x profiler-start <RET> <RET> before
running find command in term, then M-x profiler-report <RET> after a
little while. (I don't know how useful this is, but adding it to bug
report regardless.)

- term-emulate-terminal                                         24556  92%
  - #<subr vertical-motion>                                     12929  48%
    - jit-lock-function                                           152   0%
      - jit-lock-fontify-now                                      148   0%
        - byte-code                                                92   0%
          - run-hook-with-args                                     84   0%
            - font-lock-fontify-region                             84   0%
              - font-lock-default-fontify-region                   76   0%
                - font-lock-unfontify-region                       28   0%
                  - font-lock-default-unfontify-re                  8   0%
                      append                                        4   0%
                - font-lock-fontify-keywords-regio                 24   0%
                    make-marker                                     4   0%
                - font-lock-extend-region-multilin                  8   0%
                    get-text-property                               8   0%
                  byte-code                                         4   0%
                font-lock-set-defaults                              4   0%
        - run-with-timer                                            8   0%
          - apply                                                   8   0%
            - run-at-time                                           8   0%
                timer-set-time                                      4   0%
              - timer-activate                                      4   0%
                - timer--activate                                   4   0%
                  - timer--time-less-p                              4   0%
                      time-less-p                                   4   0%
  - term-down                                                    7384  27%
    - #<subr vertical-motion>                                    7072  26%
      - jit-lock-function                                         151   0%
        - jit-lock-fontify-now                                    147   0%
          - byte-code                                             111   0%
            - run-hook-with-args                                   95   0%
              - font-lock-fontify-region                           95   0%
                - font-lock-default-fontify-region                 87   0%
                  + font-lock-unfontify-region                     20   0%
                  + font-lock-fontify-keywords-reg                 12   0%
                  + font-lock-extend-region-wholel                 11   0%
                    font-lock-extend-region-multil                  4   0%
                    buffer-modified-p                               4   0%
                  font-lock-set-defaults                            4   0%
              set-match-data                                       12   0%
          - run-with-timer                                         12   0%
            - apply                                                12   0%
              - run-at-time                                        12   0%
                - timer-activate                                   12   0%
                  - timer--activate                                12   0%
                    - timer--time-less-p                           12   0%
                        time-less-p                                 8   0%
            text-property-any                                       4   0%
            put-text-property                                       4   0%
    - term-insert-char                                            271   1%
      - insert-char                                               186   0%
        - jit-lock-after-change                                   103   0%
          - run-hook-with-args                                     56   0%
            + font-lock-extend-jit-lock-region-aft                 56   0%
            put-text-property                                      16   0%
            byte-code                                               8   0%
            buffer-modified-p                                       4   0%
      + put-text-property                                          85   0%
    + term-move-columns                                            16   0%
      term-adjust-current-row-cache                                 8   0%
  - redisplay                                                    1682   6%
    - redisplay_internal (C function)                            1674   6%
      - file-remote-p                                               4   0%
          find-file-name-handler                                    4   0%
    - timer-event-handler                                           4   0%
      - byte-code                                                   4   0%
        + apply                                                     4   0%
  + term-handle-deferred-scroll                                  1162   4%
  + pos-visible-in-window-p                                       868   3%
    decode-coding-string                                          131   0%
  + put-text-property                                              76   0%
  + jit-lock-after-change                                          60   0%
    string-match                                                   45   0%
  + term-move-columns                                              12   0%
  + term-handle-ansi-terminal-messages                              7   0%
    recenter                                                        4   0%
  + term-horizontal-column                                          4   0%
    selected-window                                                 4   0%
+ call-interactively                                             1712   6%
  Automatic GC                                                    416   1%
+ list                                                              4   0%

Usual bug report info follows:

In GNU Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.6.0)
 of 2013-01-01 on louvi, modified by Debian
 (emacs-snapshot package, version 2:20121231-1~ppa1~quantal1)
System Description:	Ubuntu 12.10

Configured using:
 `configure --build x86_64-linux-gnu --host x86_64-linux-gnu
 --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man
 --with-pop=yes
 --enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.3.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3.50/site-lisp:/usr/share/emacs/site-lisp
 --without-compress-info --with-crt-dir=/usr/lib/x86_64-linux-gnu/
 --with-x=yes --with-x-toolkit=gtk3 --with-imagemagick=yes'

Important settings:
  value of $LANG: nb_NO.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Term

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC [ > 1 ; 3 4 0 0 ; 0 c ESC x t e r m RET RET C-c 
ESC x p r f o DEL DEL o f i l e r - s t a r t RET RET 
f i n d RET C-c ESC x p r o f i l e r - r e TAB p TAB 
RET C-x o C-c C-c C-x o C-c o C-n C-p RET C-n C-n C-p 
RET C-n C-n RET C-n C-n C-n C-n C-n RET C-n C-n RET 
C-n C-n RET C-n C-n C-n C-n C-n C-n C-n C-n C-n C-a 
RET C-n C-n C-p RET C-n RET C-n RET C-n RET C-p C-p 
C-p C-p RET C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-p C-p RET C-n RET C-n RET C-n C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-n C-p RET C-n RET 
C-n RET C-p C-p C-p C-p RET C-n RET C-p C-p C-p C-p 
C-p C-p C-p C-p C-n C-n C-n C-n C-n C-n C-n C-n C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-x h ESC 
w C-x 0 ESC x C-c ESC x t e r p ESC DEL r e p o r t 
- e TAB RET

Recent messages:
Invalid face attribute :foreground nil
Invalid face attribute :background nil
Invalid face attribute :foreground nil
Invalid face attribute :background nil
Invalid face attribute :foreground nil
Invalid face attribute :background nil [3 times]
Invalid face attribute :foreground nil
Invalid face attribute :background nil [2 times]
Invalid face attribute :foreground nil
Invalid face attribute :background nil

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils help-mode profiler cl-lib term disp-table easymenu
ehelp electric ring time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)

Please CC me if more info is required as I am not subscribed.
Thanks,

Øyvind S.
-- 
< Øyvind Stegard
 < http://stegard.net/