Subject: 26.3; Frame creation spends 1-2s in face-set-after-frame-default

From: Jamie Brandon <[email-masked]>
Date: Thu, 14 May 2020 11:34:49 -0700

When I launch emacsclient or make a new frame it spends 1-2s in:

   - make-frame                                                   312  42%
    - frame-creation-function                                     311  42%
     - apply                                                      311  42%
      - #<compiled 0x3edba9>                                      311  42%
       - x-create-frame-with-faces                                311  42%
        - face-set-after-frame-default                            287  39%
         + face-spec-recalc                                       274  37%

If I replace face-spec-recalc with an empty function then the new frame loads instantly so I'm pretty sure that's the culprit.

I have 523 faces in frame-face-alist but they all seem to be from packages I use regularly so I can't just get rid off them. Magit and notmuch account for a large minority of them.

https://emacs.stackexchange.com/questions/58505/emacsclient-spending-a-lot-of-time-resetting-faces suggested that this is unexpected and should be reported as a bug. 

---

In GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.13)
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
Recent messages:
widget-before-change: Text is read-only: "Attempt to change text outside editable field"
Syncing...
(Shell command succeeded with no output)
Quit [2 times]
mwheel-scroll: Beginning of buffer [13 times]
widget-before-change: Text is read-only: "Attempt to change text outside editable field"
Mark set
When done with this frame, type M-x delete-frame [2 times]
funcall-interactively: End of buffer

Configured using:
 'configure
 --prefix=/nix/store/wdad52z5419zhwv1ylha9vxhmcmrgvvc-emacs-26.3
 --disable-build-details --with-modules --with-x-toolkit=gtk3
 --with-xft CFLAGS=-DMAC_OS_X_VERSION_MAX_ALLOWED=101200'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS GLIB NOTIFY LIBSELINUX
GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Text

Minor modes in effect:
  direnv-mode: t
  global-my-mode: t
  my-mode: t
  flyspell-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  show-paren-mode: t
  xterm-mouse-mode: t
  global-magit-file-mode: t
  diff-auto-refine-mode: t
  magit-auto-revert-mode: t
  global-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  ivy-mode: t
  delete-selection-mode: t
  auto-compile-on-load-mode: t
  auto-compile-on-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  visual-line-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-wash hides /run/current-system/sw/share/emacs/site-lisp/notmuch-wash
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-hello hides /run/current-system/sw/share/emacs/site-lisp/notmuch-hello
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-print hides /run/current-system/sw/share/emacs/site-lisp/notmuch-print
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-company hides /run/current-system/sw/share/emacs/site-lisp/notmuch-company
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-mua hides /run/current-system/sw/share/emacs/site-lisp/notmuch-mua
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-draft hides /run/current-system/sw/share/emacs/site-lisp/notmuch-draft
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-jump hides /run/current-system/sw/share/emacs/site-lisp/notmuch-jump
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-lib hides /run/current-system/sw/share/emacs/site-lisp/notmuch-lib
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-tree hides /run/current-system/sw/share/emacs/site-lisp/notmuch-tree
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-crypto hides /run/current-system/sw/share/emacs/site-lisp/notmuch-crypto
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-query hides /run/current-system/sw/share/emacs/site-lisp/notmuch-query
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-maildir-fcc hides /run/current-system/sw/share/emacs/site-lisp/notmuch-maildir-fcc
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-show hides /run/current-system/sw/share/emacs/site-lisp/notmuch-show
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/coolj hides /run/current-system/sw/share/emacs/site-lisp/coolj
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-compat hides /run/current-system/sw/share/emacs/site-lisp/notmuch-compat
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-address hides /run/current-system/sw/share/emacs/site-lisp/notmuch-address
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-parser hides /run/current-system/sw/share/emacs/site-lisp/notmuch-parser
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-tag hides /run/current-system/sw/share/emacs/site-lisp/notmuch-tag
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch hides /run/current-system/sw/share/emacs/site-lisp/notmuch
/home/jamie/.emacs.d/elpa/notmuch-20200323.121/notmuch-message hides /run/current-system/sw/share/emacs/site-lisp/notmuch-message
/run/current-system/sw/share/emacs/site-lisp/site-start hides /nix/store/wdad52z5419zhwv1ylha9vxhmcmrgvvc-emacs-26.3/share/emacs/site-lisp/site-start
/home/jamie/.emacs.d/elpa/flymake-1.0.8/flymake hides /nix/store/wdad52z5419zhwv1ylha9vxhmcmrgvvc-emacs-26.3/share/emacs/26.3/lisp/progmodes/flymake
/home/jamie/.emacs.d/elpa/let-alist-1.0.6/let-alist hides /nix/store/wdad52z5419zhwv1ylha9vxhmcmrgvvc-emacs-26.3/share/emacs/26.3/lisp/emacs-lisp/let-alist

Features:
(shadow sort company-oddmuse company-keywords company-etags etags
company-gtags company-dabbrev-code company-dabbrev company-files
company-capf company-cmake company-xcode company-clang
company-semantic company-eclim company-template company-bbdb
company-tern s dash-functional tern mail-extr emacsbug sendmail
network-stream starttls url-http tls gnutls url-gw nsm url-auth
url-cache parse-time vc-mtn vc-hg vc-git vc-bzr vc-src vc-sccs vc-svn
vc-cvs vc-rcs vc vc-dispatcher elfeed-show elfeed-search
magit-bookmark bookmark shr svg dom elfeed-csv elfeed elfeed-curl url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf elfeed-log elfeed-db elfeed-lib avl-tree generator
url-queue browse-url xml-query xml notmuch-jump esh-util init direnv
flyspell ispell notmuch hl-line notmuch-hello wid-edit notmuch-tree
notmuch-show notmuch-print notmuch-crypto notmuch-mua notmuch-message
notmuch-draft notmuch-maildir-fcc notmuch-address notmuch-company
notmuch-parser notmuch-wash coolj notmuch-query goto-addr icalendar
diary-lib diary-loaddefs cal-menu calendar cal-loaddefs notmuch-tag
notmuch-lib notmuch-version notmuch-compat mm-view mml-smime smime dig
mailcap ivy-xref format-all language-id eglot array jsonrpc ert pp
ewoc debug flymake-proc flymake warnings url-util rust-mode undo-tree
diff paren xt-mouse magit-submodule magit-obsolete magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull
magit-fetch magit-clone magit-remote magit-commit magit-sequence
magit-notes magit-worktree magit-tag magit-merge magit-branch
magit-reset magit-files magit-refs magit-status magit magit-repos
magit-apply magit-wip magit-log which-func imenu magit-diff
smerge-mode diff-mode magit-core magit-autorevert autorevert
filenotify magit-margin magit-transient magit-process magit-mode
git-commit transient magit-git magit-section magit-utils crm log-edit
message rmc puny format-spec rfc822 mml mml-sec epa derived epg
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log
with-editor async-bytecomp async shell pcomplete server deferred
markdown-mode noutline outline easy-mmode julia-mode
julia-mode-latexsubs hide-lines counsel xdg xref project dired
dired-loaddefs compile comint swiper ivy flx delsel ring colir color
ivy-overlay company-quickhelp pos-tip company edmacro kmacro pcase
flycheck cl-extra ansi-color json map find-func help-mode rx subr-x
dash multiple-cursors mc-hide-unmatched-lines-mode
mc-separate-operations rectangular-region-mode mc-mark-pop
mc-mark-more thingatpt mc-cycle-cursors mc-edit-lines
multiple-cursors-core advice rect jka-compr atom-one-dark-theme
time-date auto-compile packed finder-inf cl info package easymenu
epg-config url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache url-vars seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib mule-util tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow
isearch timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 503125 298802)
 (symbols 48 46802 2)
 (miscs 40 178 409)
 (strings 32 200303 194203)
 (string-bytes 1 5806953)
 (vectors 16 75940)
 (vector-slots 8 1524646 148766)
 (floats 8 4543 7707)
 (intervals 56 575 246)
 (buffers 992 17))