Subject: 26.0; `char-displayable-p' is much slower in Emacs 25 and 26
From: Drew Adams <[email-masked]>
To: [email-masked]
Date: Mon, 19 Feb 2018 14:07:40 -0800 (PST)
List-Id: <debbugs-submit.debbugs.gnu.org>

This is not from emacs -Q, and I do have many fonts installed.  I
repeated it from emacs -Q and I've attached those profiler reports
also.  But with emacs -Q the test code (`my-test') finished
immediately.  With my setup it took many seconds.  I use this font
by default - dunno whether that makes the difference:

(font . "-outline-Lucida Console-normal-normal-normal-mono-4-*-*-*-c-*-iso8859-1")
(font-parameter . "-*-Lucida Console-normal-r-*-*-14-*-*-*-c-*-iso8859-1")

Recipe I followed:

Evaluate the attached code (`throw-mule-bug.el'), then look at buffers
*CPU Profiler Report* and *Memory Profiler Report*.  I've attached these
reports as files:

throw-mule-bug-memory-report-E26-Q - Emacs 26 from emacs -Q
throw-mule-bug-cpu-report-E26-Q    - Emacs 26 from emacs -Q
throw-mule-bug-memory-report-E24 - Emacs 24.5 with my setup
throw-mule-bug-cpu-report-E24    - Emacs 24.5 with my setup
throw-mule-bug-memory-report-E26 - Emacs 26P2 with my setup
throw-mule-bug-cpu-report-E26    - Emacs 26P2 with my setup
 
In Emacs 25.3.1 and 26 `char-displayable-p' is MUCH slower
than it is in Emacs 24.5.  In 24.5 the evaluation of `my-test'
seems instantaneous.  In Emacs 26 it takes many seconds.

From the reports, using my setup:

E26 memory:

- my-delete-if-not                         225,165,075  52%
 - let                                     222,218,069  51%
  - while                                  222,218,069  51%
   - if                                    222,218,069  51%
    - not                                  222,218,069  51%
     - funcall                             222,218,069  51%
      - my-char-displayable-p              222,218,069  51%
       - char-displayable-p                222,218,069  51%
        - cond                             222,218,069  51%
           let                             189,022,646  43%
 - while                                     2,947,006   0%
  - and                                      2,947,006   0%
   - not                                     2,947,006   0%
    - funcall                                2,947,006   0%
     - my-char-displayable-p                 2,947,006   0%
      - char-displayable-p                   2,947,006   0%
       - cond                                2,947,006   0%
          let                                1,836,898   0%

E26 cpu:

- my-delete-if-not                                1609  70%
 - let                                            1602  70%
  - while                                         1602  70%
   - if                                           1602  70%
    - not                                         1602  70%
     - funcall                                    1602  70%
      - my-char-displayable-p                     1602  70%
       - char-displayable-p                       1602  70%
        - cond                                    1602  70%
           let                                    1602  70%
 - while                                             7   0%
  - and                                              7   0%
   - not                                             7   0%
    - funcall                                        7   0%
     - my-char-displayable-p                         7   0%
      - char-displayable-p                           7   0%
       - cond                                        7   0%
          let                                        7   0%

In GNU Emacs 26.0.91 (build 1, x86_64-w64-mingw32)
 of 2018-01-22
Repository revision: 752fba992b793a74d202c9cfc3e1a92fd458e748
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''