bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26402: 25.2; Font rendering extremely slow on any non-default font


From: Gennady Uraltsev
Subject: bug#26402: 25.2; Font rendering extremely slow on any non-default font
Date: Sun, 9 Apr 2017 00:33:23 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

[Sorry about the CC, must have escaped me]

I recompiled from latest git of today so emacs decalres version 26.0.50
I tried recompiling without your patch and also with your patch. No
apparent improvement

I tried running both (text-scale-adjust INC) and buffer-set-face
both with and without (setq inhibit-compacting-font-caches t)

The profiler profiles are attached.
The profiler output for moving the cursor down from the beginning of the
file to the end are as follows:

*****************
M-x buffer-set-face variable-width
without (setq inhibit-compacting-font-caches t)
*****************
> - command-execute                                                2227  99%
>  - call-interactively                                            2227  99%
>   - funcall-interactively                                        2189  98%
>    - next-line                                                   2176  97%
>     - line-move                                                  2176  97%
>      - line-move-partial                                         1560  69%
>       - default-line-height                                       808  36%
>          default-font-height                                      808  36%
>       - window-screen-lines                                       752  33%
>        - default-line-height                                      752  33%
>           default-font-height                                     752  33%
>      - default-line-height                                        616  27%
>         default-font-height                                       612  27%
>       - display-graphic-p                                           4   0%
>          framep-on-display                                          4   0%
>    - execute-extended-command                                      13   0%
>     - sit-for                                                      13   0%
>        redisplay                                                    8   0%
>   - byte-code                                                      34   1%
>    - read-extended-command                                         34   1%
>     - completing-read                                              34   1%
>      - completing-read-default                                     34   1%
>       - read-from-minibuffer                                       17   0%
>        - window--sanitize-window-sizes                              5   0%
>         - walk-window-tree                                          5   0%
>          - walk-window-tree-1                                       5   0%
>           - #<compiled 0x4a56e9>                                    5   0%
>              window-min-size                                        5   0%
> - ...                                                               4   0%
>    Automatic GC                                                     4   0%


*****************
M-x buffer-set-face variable-width
with (setq inhibit-compacting-font-caches t)
*****************

> - command-execute                                                2509  99%
>  - call-interactively                                            2509  99%
>   - funcall-interactively                                        2459  97%
>    - next-line                                                   2415  96%
>     - line-move                                                  2415  96%
>      - line-move-partial                                         1763  70%
>       - default-line-height                                       887  35%
>          default-font-height                                      887  35%
>       - window-screen-lines                                       876  34%
>        - default-line-height                                      876  34%
>           default-font-height                                     876  34%
>      - default-line-height                                        652  25%
>         default-font-height                                       652  25%
>    - execute-extended-command                                      44   1%
>     - sit-for                                                      23   0%
>      - redisplay                                                   12   0%
>       - redisplay_internal (C function)                             4   0%
>          kill-this-buffer-enabled-p                                 4   0%
>     - command-execute                                              21   0%
>      - call-interactively                                          21   0%
>       - funcall-interactively                                      21   0%
>        - profiler-report                                           21   0%
>         - profiler-report-cpu                                      21   0%
>            profiler-cpu-profile                                    21   0%
>   - byte-code                                                      50   1%
>    - read-extended-command                                         50   1%
>     - completing-read                                              50   1%
>      - completing-read-default                                     50   1%
>       - read-from-minibuffer                                       21   0%
>        - command-execute                                            3   0%
>         - call-interactively                                        3   0%
>          - funcall-interactively                                    3   0%
>             delete-backward-char                                    3   0%
> - ...                                                               5   0%
>    Automatic GC                                                     5   0%





On 08/04/17 19:18, Eli Zaretskii wrote:
> [Please keep the bug address on the CC list.]
> 
>> From: Gennady Uraltsev <gennady.uraltsev@gmail.com>
>> Date: Sat, 8 Apr 2017 18:32:34 +0200
>>
>> The default font that emacs -Q starts with is
>>
>> xft:-adobe-Source Code
>> Pro-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1 (#x2C)
>>
>> (I guess it comes from the fact that that is my predefined qt and gtk
>> monospace font)
>>
>> once zooming in (text-scale-adjust INC) I get
>>
>> xft:-adobe-Source Code
>> Pro-normal-normal-normal-*-18-*-*-*-m-0-iso10646-1 (#x1E)
>>
>> If instead of zooming in I do M-x buffer-face-set variable-pitch
>> I get the font
>>
>>   xft:-unknown-Roboto-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1 (#x48)
>>
>>
>>
>> I can also replicate this by setting the global font to be something
>> else like
>>
>> xft:-unknown-Droid Sans-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1
>> (#x54)
>> xft:-monotype-Noto Sans-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1
>> (#x36)
>>
>> at the level of the frame by using
>>
>> M-x set-frame-font
>> -unknown-Droid Sans-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1
>> or
>> -monotype-Noto Sans-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1
>>
>> respectively. This does not have a negative impact on performance. But
>> as soon as I enable  something like
>>
>> M-x buffer-face-set fixed-pitch or
>> (text-scale-adjust INC) the problem returns
> 
> Can you build your own Emacs?  If so, could you please apply the
> following patch and see if it solves the problem?
> 
> diff --git a/src/font.c b/src/font.c
> index a929509..bb6d18b 100644
> --- a/src/font.c
> +++ b/src/font.c
> @@ -2777,21 +2777,22 @@ font_list_entities (struct frame *f, Lisp_Object spec)
>         val = XCDR (val);
>       else
>         {
> -         val = driver_list->driver->list (f, scratch_font_spec);
> -         if (!NILP (val))
> -           {
> -             Lisp_Object copy = copy_font_spec (scratch_font_spec);
> +         Lisp_Object copy;
>  
> -             val = Fvconcat (1, &val);
> -             ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
> -             XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache)));
> -           }
> +         val = driver_list->driver->list (f, scratch_font_spec);
> +         if (NILP (val))
> +           val = zero_vector;
> +         else
> +           val = Fvconcat (1, &val);
> +         copy = copy_font_spec (scratch_font_spec);
> +         ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
> +         XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache)));
>         }
> -     if (VECTORP (val) && ASIZE (val) > 0
> +     if (ASIZE (val) > 0
>           && (need_filtering
>               || ! NILP (Vface_ignored_fonts)))
>         val = font_delete_unmatched (val, need_filtering ? spec : Qnil, size);
> -     if (VECTORP (val) && ASIZE (val) > 0)
> +     if (ASIZE (val) > 0)
>         list = Fcons (val, list);
>        }
>  
> 

Attachment: BAD-patched-buffer-set-face-profile
Description: Text document

Attachment: BAD-patched-inhibit-cache-buffer-set-face-profile
Description: Text document

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]