GNU bug report logs - #13337
24.3.50; Slow display in term mode (M-x term)

Previous Next

Package: emacs;

Reported by: Øyvind Stegard <oyvinst <at> ifi.uio.no>

Date: Wed, 2 Jan 2013 18:47:01 UTC

Severity: normal

Found in version 24.3.50

Fixed in version 24.2.92

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13337 in the body.
You can then email your comments to 13337 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13337; Package emacs. (Wed, 02 Jan 2013 18:47:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Øyvind Stegard <oyvinst <at> ifi.uio.no>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 02 Jan 2013 18:47:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Øyvind Stegard <oyvinst <at> ifi.uio.no>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; Slow display in term mode (M-x term)
Date: Wed, 02 Jan 2013 15:10:09 +0100
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/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13337; Package emacs. (Thu, 03 Jan 2013 06:40:01 GMT) Full text and rfc822 format available.

Message #8 received at 13337 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Øyvind Stegard <oyvinst <at> ifi.uio.no>
Cc: 13337 <at> debbugs.gnu.org
Subject: Re: bug#13337: 24.3.50; Slow display in term mode (M-x term)
Date: Thu, 03 Jan 2013 01:39:12 -0500
Does this patch help with performance? It should at least make the
"Invalid face attribute" messages go away.

*** lisp/term.el	2013-01-03 06:33:25 +0000
--- lisp/term.el	2013-01-03 06:37:25 +0000
***************
*** 3216,3233 ****
          (let ((color
                 (if term-ansi-current-reverse
                     (face-foreground
!                     (elt ansi-term-color-vector term-ansi-current-color))
                   (face-background
!                   (elt ansi-term-color-vector term-ansi-current-bg-color)))))
            (setq term-current-face
                  (list :background color
                        :foreground color))
            ) ;; No need to bother with anything else if it's invisible.
        (setq term-current-face
              (list :foreground
!                   (face-foreground (elt ansi-term-color-vector term-ansi-current-color))
                    :background
!                   (face-background (elt ansi-term-color-vector term-ansi-current-bg-color))
                    :inverse-video term-ansi-current-reverse))
  
        (when term-ansi-current-bold
--- 3216,3239 ----
          (let ((color
                 (if term-ansi-current-reverse
                     (face-foreground
!                     (elt ansi-term-color-vector term-ansi-current-color)
!                     nil 'default)
                   (face-background
!                   (elt ansi-term-color-vector term-ansi-current-bg-color)
!                   nil 'default))))
            (setq term-current-face
                  (list :background color
                        :foreground color))
            ) ;; No need to bother with anything else if it's invisible.
        (setq term-current-face
              (list :foreground
!                   (face-foreground
!                    (elt ansi-term-color-vector term-ansi-current-color)
!                    nil 'default)
                    :background
!                   (face-background
!                    (elt ansi-term-color-vector term-ansi-current-bg-color)
!                    nil 'default)
                    :inverse-video term-ansi-current-reverse))
  
        (when term-ansi-current-bold





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13337; Package emacs. (Thu, 03 Jan 2013 10:10:02 GMT) Full text and rfc822 format available.

Message #11 received at 13337 <at> debbugs.gnu.org (full text, mbox):

From: Øyvind Stegard <oyvinst <at> ifi.uio.no>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 13337 <at> debbugs.gnu.org
Subject: Re: bug#13337: 24.3.50; Slow display in term mode (M-x term)
Date: Thu, 03 Jan 2013 11:09:33 +0100
Glenn Morris <rgm <at> gnu.org> writes:

> Does this patch help with performance? It should at least make the
> "Invalid face attribute" messages go away.

Yes, the patch helps. Face attribute error messages are gone and
rendering speed is improved.

Thanks,
-- 
< Øyvind Stegard
 < http://stegard.net/




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Thu, 03 Jan 2013 18:33:02 GMT) Full text and rfc822 format available.

Notification sent to Øyvind Stegard <oyvinst <at> ifi.uio.no>:
bug acknowledged by developer. (Thu, 03 Jan 2013 18:33:02 GMT) Full text and rfc822 format available.

Message #16 received at 13337-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 13337-done <at> debbugs.gnu.org
Subject: Re: bug#13337: 24.3.50; Slow display in term mode (M-x term)
Date: Thu, 03 Jan 2013 13:32:33 -0500
Version: 24.2.92

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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 01 Feb 2013 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 107 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.