Subject: RE: bug#30539: 26.0; `char-displayable-p' is much slower in Emacs 25 and 26

From: Drew Adams <[email-masked]>
Date: Thu, 22 Feb 2018 18:43:21 -0800 (PST)

> > Can someone please confirm that they can repro this problem?
> 
> I can reproduce on a Windows 10 box.  It looks like something was being
> cached before, where now it's not.  E.g., try the following function
> (char-names as defined in your throw-mule-bug-2.el).  In Emacs 24,
> there's only one slow call.
> 
> (defun my-test-each-char ()
>   (interactive)
>   (view-echo-area-messages)
>   (pcase-dolist (`(,name . ,ch) char-names)
>     (read-char (format "continue? (next: %s)" name))
>     (let ((t0 (current-time))
>           dt displayable)
>       (setq displayable (char-displayable-p ch))
>       (setq dt (subtract-time (current-time) t0))
>       (message "%s display:%s (%fs)" name displayable (float-time dt)))))
> 
> Doing (setq inhibit-compacting-font-caches t) brings back reasonable
> performance.
> 
> I can't reproduce on my GNU/Linux box, although that may just be due to
> different fonts installed.  In particular, char-displayable-p never gave
> me nil.

Thanks, Noam.  Yes, I see the same thing: over 4 sec for each
char that is not displayable.

I couldn't try your code with Emacs 24.5 because `pcase-dolist'
and `inhibit-compacting-font-caches' are both undefined.  (How
did you test it in 24.5, or did I misunderstand you?)

But everything else you say checks out, including the effect
of (setq inhibit-compacting-font-caches t).

Is this a bug that is likely to get fixed?

In any case, for Emacs 25-26, I wonder whether I should bind
`inhibit-compacting-font-caches to `t' in my code that uses
`char-displayable-p', or whether I should just skip the
`char-displayable-p' test for Emacs 25-26.

Another question is whether this bug should/will affect all
users or only some?  If the latter then I can let users
decide whether to test `char-displayable-p' (I have an
option for that anyway) or whether to bind
`inhibit-compacting-font-caches to `t'.  If only some users
are affected by the bug, do we know why?  Does it have to
do with the fonts they have installed, for example?