unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Gennady Uraltsev <gennady.uraltsev@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 26402@debbugs.gnu.org
Subject: bug#26402: 25.2; Font rendering extremely slow on any non-default font
Date: Sun, 9 Apr 2017 00:33:23 +0200	[thread overview]
Message-ID: <2a3d3577-ccbf-c30f-15ab-390cd1cd5278@gmail.com> (raw)
In-Reply-To: <83bms6n7hk.fsf@gnu.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 8717 bytes --]

[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 #1.1.2: BAD-patched-buffer-set-face-profile --]
[-- Type: text/plain, Size: 1873 bytes --]


[profiler-profile "24.3" cpu #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ([redisplay sit-for execute-extended-command funcall-interactively call-interactively command-execute nil nil nil nil nil nil nil nil nil nil] 8 [sit-for execute-extended-command funcall-interactively call-interactively command-execute nil nil nil nil nil nil nil nil nil nil nil] 5 [default-font-height default-line-height line-move-partial line-move next-line funcall-interactively call-interactively command-execute nil nil nil nil nil nil nil nil] 808 [default-font-height default-line-height window-screen-lines line-move-partial line-move next-line funcall-interactively call-interactively command-execute nil nil nil nil nil nil nil] 752 [default-font-height default-line-height line-move next-line funcall-interactively call-interactively command-execute nil nil nil nil nil nil nil nil nil] 612 [call-interactively command-execute nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 4 [framep-on-display display-graphic-p default-line-height line-move next-line funcall-interactively call-interactively command-execute nil nil nil nil nil nil nil nil] 4 [nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 5 [completing-read-default completing-read read-extended-command byte-code call-interactively command-execute nil nil nil nil nil nil nil nil nil nil] 17 [read-from-minibuffer completing-read-default completing-read read-extended-command byte-code call-interactively command-execute nil nil nil nil nil nil nil nil nil] 12 [window-min-size "#<compiled 0x4a56e9>" walk-window-tree-1 walk-window-tree window--sanitize-window-sizes read-from-minibuffer completing-read-default completing-read read-extended-command byte-code call-interactively command-execute nil nil nil nil] 5 [Automatic\ GC] 4)) (22761 25294 926762 984000) nil]

[-- Attachment #1.1.3: BAD-patched-inhibit-cache-buffer-set-face-profile --]
[-- Type: text/plain, Size: 2010 bytes --]


[profiler-profile "24.3" cpu #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ([kill-this-buffer-enabled-p redisplay_internal\ \(C\ function\) redisplay sit-for execute-extended-command funcall-interactively call-interactively command-execute nil nil nil nil nil nil nil nil] 4 [redisplay sit-for execute-extended-command funcall-interactively call-interactively command-execute nil nil nil nil nil nil nil nil nil nil] 8 [sit-for execute-extended-command funcall-interactively call-interactively command-execute nil nil nil nil nil nil nil nil nil nil nil] 11 [default-font-height default-line-height line-move-partial line-move next-line funcall-interactively call-interactively command-execute nil nil nil nil nil nil nil nil] 887 [default-font-height default-line-height window-screen-lines line-move-partial line-move next-line funcall-interactively call-interactively command-execute nil nil nil nil nil nil nil] 876 [default-font-height default-line-height line-move next-line funcall-interactively call-interactively command-execute nil nil nil nil nil nil nil nil nil] 652 [nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 7 [read-from-minibuffer completing-read-default completing-read read-extended-command byte-code call-interactively command-execute nil nil nil nil nil nil nil nil nil] 18 [completing-read-default completing-read read-extended-command byte-code call-interactively command-execute nil nil nil nil nil nil nil nil nil nil] 29 [delete-backward-char funcall-interactively call-interactively command-execute read-from-minibuffer completing-read-default completing-read read-extended-command byte-code call-interactively command-execute nil nil nil nil nil] 3 [profiler-cpu-profile profiler-report-cpu profiler-report funcall-interactively call-interactively command-execute execute-extended-command funcall-interactively call-interactively command-execute nil nil nil nil nil nil] 21 [Automatic\ GC] 5)) (22761 25503 836230 71000) nil]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-04-08 22:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-08 13:48 bug#26402: 25.2; Font rendering extremely slow on any non-default font Gennady Uraltsev
2017-04-08 14:44 ` Eli Zaretskii
2017-04-08 14:54   ` Gennady Uraltsev
2017-04-08 16:10     ` Eli Zaretskii
     [not found]       ` <541302bf-540b-aedb-4ca4-2ba3acfe495e@gmail.com>
2017-04-08 17:18         ` Eli Zaretskii
2017-04-08 22:33           ` Gennady Uraltsev [this message]
2017-04-09  5:44             ` Eli Zaretskii
2017-04-09  9:45               ` Eli Zaretskii
2017-04-09 11:07                 ` Gennady Uraltsev
2017-04-09 11:59                   ` Eli Zaretskii
2019-11-17  7:47                     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2a3d3577-ccbf-c30f-15ab-390cd1cd5278@gmail.com \
    --to=gennady.uraltsev@gmail.com \
    --cc=26402@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).