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

From: <[email-masked]>
Date: Thu, 2 Apr 2020 18:29:07 -0400

By default the font that gets used is

          display: by this font (glyph code)
 
uniscribe:-outline-Arial-normal-normal-normal-sans-20-*-*-*-p-*-iso8859-1
(#x03)

as given by describe-char. On the other hand I can, before enabling the
mode, execute

  (custom-set-faces
 '(variable-pitch ((t (:height 120 :family "Segoe UI" :foundry "MS  " :slant
normal :weight normal :width normal)))))

and this gives

display: by this font (glyph code)
uniscribe:-outline-Segoe UI-normal-normal-normal-sans-24-*-*-*-p-*-iso8859-1
(#x37)

But slowness happens in both cases.

Here are the profiler reports for CPU for scrolling about 2 pages worth of
text by pushing the down arrow:
******Normal*******
- command-execute                                                   3  75%
 - call-interactively                                               3  75%
  - byte-code                                                       3  75%
   - read-extended-command                                          3  75%
    - completing-read                                               3  75%
     - completing-read-default                                      3  75%
        read-from-minibuffer                                        2  50%
- ...                                                               1  25%
   Automatic GC                                                     1  25%

******variable-pitch-mode*******
- command-execute                                                  92  97%
 - call-interactively                                              92  97%
  - funcall-interactively                                          91  96%
   - next-line                                                     89  94%
    - line-move                                                    89  94%
     - line-move-partial                                           59  62%
      - default-line-height                                        36  38%
         default-font-height                                       36  38%
      - window-screen-lines                                        23  24%
       - default-line-height                                       23  24%
          default-font-height                                      23  24%
     - default-line-height                                         30  31%
        default-font-height                                        30  31%
   - execute-extended-command                                       2   2%
    - sit-for                                                       2   2%
       redisplay                                                    2   2%
  - byte-code                                                       1   1%
   - read-extended-command                                          1   1%
    - completing-read                                               1   1%
     - completing-read-default                                      1   1%
      - read-from-minibuffer                                        1   1%
       - redisplay_internal (C function)                            1   1%
        - tool-bar-make-keymap                                      1   1%
         - tool-bar-make-keymap-1                                   1   1%
          - mapcar                                                  1   1%
           - #<compiled 0x1000d70c9>                                1   1%
            - eval                                                  1   1%
             - find-image                                           1   1%
                image-search-load-path                              1   1%
- ...                                                               2   2%
   Automatic GC                                                     2   2%

Thanks! 

-----Original Message-----
From: Eli Zaretskii <[email-masked]> 
Sent: Thursday, 2 April, 2020 10:41
To: [email-masked]
Cc: [email-masked]
Subject: Re: 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.

I don't think I can reproduce this.

Which font is used on your system when you turn on variable-pitch-mode?
(You can type "C-u C-x =" on a character to see the font used to display
it.)

> Attached are profiler results for moving down two pages worth of text.

Thanks, but you provided a "memory" profile, which is almost useless.
Please provide the "cpu" profile instead, and please show it in
human-readable form (after performing the measurement, type "M-x
profiler-report RET", then go to each top-level "+" sign and type "C-u RET"
to expand the profile; and finally paste the result into your message and
send it).