Subject: bug#40384: 26.3; [Windows10] variable-pitch-mode is slow to redraw

From: <[email-masked]>
Date: Wed, 1 Apr 2020 20:06:38 -0400

I am trying to emacs under Windows 10. variable-pitch-mode is insanely slow
in redrawing the screen. With a clean emacs.d I opened a text file and tried
pressing the down arrow. The cursor gets redisplayed every 10 lines or so
and emacs is very sluggish. It is interesting that this DOES NOT happen with
a normal, fixed-pitch, font and also does NOT happen if I set the default
font to be a variable pitch one e.g. "Segoe UI". It only happens with
variable-pitch-mode.

The same problem appears with all win32 versions of emacs that I found:

the cygwin emacs-32 package

$ uname -a
CYGWIN_NT-10.0 malevich 3.1.4(0.340/5/3) 2020-02-19 08:49 x86_64 Cygwin
$ emacs-w32.exe --version
GNU Emacs 26.3

the official package:

$ emacs.exe --version
GNU Emacs 26.3

and with NTEmacs. 

Also, interestingly enough, page by page movement with pg-down with
variable-pitch-mode seems ok and snappy. No fontification is active in my
attempts as I opened everything in fundamental mode.

Specifically, to reproduce start a clean emacs, dismiss the startup
screen and yank copies of the first two lines of the scratch buffer to
fill in your screen: 35 lines? Now execute: M-x variable-pitch-mode and
try moving around using arrow keys (up and down). The system slows down
and starts updating once every 0.5 -1 sec if you hold down/ input
movement keys consecutively. This does not happen on X11 builds.

If you change font, this problem still remains. Attached are 
profiler results for moving down two pages worth of text. 

In GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
 of 2019-08-29 built on CIRROCUMULUS
Repository revision: 96dd0196c28bc36779584e47fffcca433c9309cd
Windowing system distributor 'Microsoft Corp.', version 10.0.18363
Recent messages:
Buffer-Face mode enabled
funcall-interactively: End of buffer [3 times]
C-h C-g is undefined
Making completion list...
Type C-x 1 to delete the help window, C-M-v to scroll help.
previous-line: Beginning of buffer [65 times]
scroll-up-command: End of buffer
next-line: End of buffer [2 times]
Making completion list...
scroll-up-command: End of buffer

Configured using:
 'configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS THREADS LCMS2

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1251

Major mode: Lisp Interaction

Minor modes in effect:
  buffer-face-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-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
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
mml-sec password-cache epa derived epg epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils pp wid-edit descr-text help-mode easymenu
cl-loaddefs cl-lib face-remap elec-pair time-date mule-util tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads w32notify w32
lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 104193 13728)
 (symbols 48 32234 1)
 (miscs 40 63 381)
 (strings 32 86233 1404)
 (string-bytes 1 1941437)
 (vectors 16 15512)
 (vector-slots 8 899538 14224)
 (floats 8 63 228)
 (intervals 56 417 52)
 (buffers 992 14))