Subject: bug#10539: 24.0.92; low display-time-interval makes Emacs slow

From: Michael Heerdegen <[email-masked]>
Date: Wed, 18 Jan 2012 02:52:03 +0100

Hello,

in emacs -Q, set `display-time-interval' to 1 and enable
`display-time-mode'.

The docstring of `display-time-interval' says "Seconds between updates
of time in the mode line.".  Ok, fine.  The doc of
`display-time-string-forms' includes an example which makes
`display-time-mode' show seconds.  So, the user may think setting
`display-time-interval' to 1 is a good idea.

But it is currently not, on the contrary.

First of all, `display-time-update' is a long, complex function.
Running only its calculations every second consumes some percent CPU by
itself.

Second, the doc of `display-time-update' says

  Update the display-time info for the mode line.
  However, don't redisplay right now.

But it _does_ redisplay, it calls `force-mode-line-update' explicitly at
the end of the code!

If I redefine `display-time-update' so that it doesn't call
`force-mode-line-update', the update of the time in the mode-line
surprisingly still works, I get an update every second.  So, maybe the
call to `force-mode-line-update' can be removed.

Now I disable global font lock and such CPU eating minor mode stuff.  I
visit my ~/.newsrc.eld which has 647k.  My CPU consumption gets nearly
100%, it takes several seconds until q (`View-quit') gets processed.  If
I visit that file with `display-time-mode' off, that doesn't happen.

So, at the end, you could try to make `display-time-mode' more
effective.  If `display-time-update' does redisplay, then the doc should
say so.  And if we can't improve things, then the docstring of
`display-time-interval' should say that low values are 
deprecated because they decrease Emacs' performance.

Thanks,

Michael.

In GNU Emacs 24.0.92.1 (i486-pc-linux-gnu, GTK+ Version 3.2.3)
 of 2012-01-11 on zelenka, modified by Debian
 (emacs-snapshot package, version 1:20120111-1)
Windowing system distributor `The X.Org Foundation', version 11.0.11102902
configured using `configure  '--build' 'i486-linux-gnu' '--host' 'i486-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.0.92/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.0.92/site-lisp:/usr/share/emacs/site-lisp' '--without-compress-info' '--with-crt-dir=/usr/lib/i386-linux-gnu/' '--with-x=yes' '--with-x-toolkit=gtk3' '--with-imagemagick=yes' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2''

Important settings:
  value of $LC_ALL: de_DE.utf8
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: C
  value of $LANG: de_DE.utf8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t