Subject: 31.0.50; Rendering HTML email is very slow since commit #eab14d68b2e72b9a6b8b0cc67c9667c2bfbed4f5

From: Iñigo Serna <[email-masked]>
Date: Mon, 21 Apr 2025 10:34:01 +0200

Hi,

Since a few weeks ago I'm noting that HTML emails rendering is 
very slow,
f.e. from 1 second to 5-6 seconds.

I compile Emacs with PGTK and Native Compilation every week on
GNU/Linux Fedora 41/42, and use mu4e to read emails.
More info of my compilation flags below.

Today I got some free time and proceed to profile the issue, it 
showed
~10x more time in function 'shr-render-td-1' vs emacs v30.1.

As this function is not changed since time ago I've bisected the 
problem,
which showed that the commit 
#eab14d68b2e72b9a6b8b0cc67c9667c2bfbed4f5
was the culprit:

   [machine] /h/_/l/d/emacs.bug > git bisect good
       eab14d68b2e72b9a6b8b0cc67c9667c2bfbed4f5 is the first bad 
       commit
   commit eab14d68b2e72b9a6b8b0cc67c9667c2bfbed4f5
   Author: Gerd Möllmann <[email-masked]>
       Make sure to initialize glyph::frame to NULL (bug#77039)
               * src/dispnew.c (adjust_glyph_matrix): Clear glyph 
               memory when
       enlarging window-system window glyph matrices.
    src/dispnew.c | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)

If I comment out the two lines added in this commit, problem 
disappears.

I've read bug #77039 comment but it's way off my understanding.

But looking deeper into the problem, it is related with my own 
theme,
which hides mode-line of non-active windows by setting its height 
to a
small value:

   (mode-line-inactive ((((type tty)) (:background "#222222" 
   :foreground
,elms-fg :height 0.1))
                       (((type graphic)) (:background ,elms-bg
:foreground ,elms-fg :height 0.1))))

If remove that height attribute (or set it to a bigger value such 
as
0.6) the issue disappears.

Thanks,
-- 
Iñigo Serna

########################################################################

In GNU Emacs 31.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
 3.24.49, cairo version 1.18.2) of 2025-04-20 built on zeus
Repository revision: 8c04396b198e81c1467314e44b720e3322ca8643
Repository branch: master
System Description: Fedora Linux 42 (Workstation Edition)

Configured using:
 'configure -C --prefix=/opt/emacs.git --with-pgtk --with-xinput2
 --without-xwidgets --with-native-compilation=aot 
 --with-tree-sitter
 --disable-gc-mark-trace 'CFLAGS=-O2 -mtune=native -march=native
 -fomit-frame-pointer''
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ 
JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP 
NOTIFY
INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB
Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  telega-root-auto-fill-mode: t
  telega-contact-birthdays-mode: t
  telega-active-video-chats-mode: t
  telega-active-locations-mode: t
  telega-patrons-mode: t
  telega-notifications-mode: t
  telega-active-stories-mode: t
  global-highlight-changes-mode: t
  highlight-changes-visible-mode: t
  beacon-mode: t
  server-mode: t
  consult-denote-mode: t
  denote-rename-buffer-mode: t
  denote-menu-bar-mode: t
  mu4e-modeline-mode: t
  which-key-mode: t
  pdf-occur-global-minor-mode: t
  nerd-icons-completion-mode: t
  mini-modeline-mode: t
  diff-hl-flydiff-mode: t
  global-diff-hl-mode: t
  global-colorful-mode: t
  colorful-mode: t
  binky-mode: t
  global-atomic-chrome-edit-mode: t
  outline-minor-mode: t
  marginalia-mode: t
  vertico-indexed-mode: t
  vertico-multiform-mode: t
  savehist-mode: t
  vertico-mode: t
  symbol-overlay-mode: t
  flymake-mode: t
  dumb-jump-mode: t
  corfu-popupinfo-mode: t
  corfu-indexed-mode: t
  global-corfu-mode: t
  corfu-mode: t
  electric-pair-mode: t
  recentf-mode: t
  delete-selection-mode: t
  minibuffer-depth-indicate-mode: t
  save-place-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  minibuffer-regexp-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t
  hs-minor-mode: t

Load-path shadows:
None found.

Features:
(shadow shr-color sort gnus-cite mm-archive mail-extr qp textsec
uni-scripts idna-mapping ucs-normalize uni-confusable 
textsec-check
em-unix em-term em-script em-prompt em-pred em-ls em-hist em-glob
em-extpipe em-cmpl em-dirs em-basic em-banner em-alias esh-mode 
esh-var
telega-obsolete telega telega-tdlib-events telega-match 
telega-root
telega-info telega-chat telega-modes telega-company telega-emoji
telega-user telega-notifications telega-voip telega-msg 
telega-story
telega-webpage visual-fill-column telega-tme telega-sticker
telega-vvnote telega-ffplay telega-i18n telega-sort telega-filter
telega-ins telega-inline telega-util telega-folders telega-topic
telega-media telega-tdlib telega-server telega-core cursor-sensor
telega-customize emacsbug display-line-numbers network-stream 
url-http
url-gw nsm url-cache url-auth help-fns radix-tree vertico-sort 
orderless
org-indent oc-basic ol-eww ol-rmail ol-mhe ol-irc ol-info ol-gnus
nnselect ol-docview doc-view ol-bibtex bibtex ol-bbdb ol-w3m 
ol-doi
org-link-doi go-mode find-file etags fileloop calc calc-loaddefs
calc-macs denote-journal hilit-chg beacon server tramp-adb 
tramp-cache
time-stamp tramp-sh checkdoc lisp-mnt vterm vterm-module 
term/xterm
xterm flyspell ispell transient consult-denote denote calfw-org
org-capture org-agenda calfw-ical icalendar diary-lib 
diary-loaddefs
calfw-cal calfw edmacro holidays holiday-loaddefs org-contacts cl
ob-python ob-shell org-superstar org-protocol timezone 
mu4e-contrib mu4e
mu4e-org mu4e-notification mu4e-main smtpmail mu4e-view 
mu4e-mime-parts
crm mu4e-headers mu4e-thread mu4e-actions mu4e-compose mu4e-draft
gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig
gnus-sum gnus-group gnus-undo gnus-start gnus-dbus gnus-cloud 
nnimap
nnmail mail-source utf7 nnoo gnus-spec gnus-int gnus-range 
gnus-win
mu4e-search mu4e-lists mu4e-bookmarks mu4e-mark mu4e-message 
flow-fill
mu4e-contacts mu4e-update mu4e-folders mu4e-context 
mu4e-query-items
mu4e-server mu4e-modeline mu4e-vars mu4e-helpers mu4e-config 
mu4e-window
mu4e-obsolete which-key printing ps-print ps-print-loaddefs lpr
per-buffer-theme pdf-occur ibuf-ext ibuffer ibuffer-loaddefs 
tablist
tablist-filter semantic/wisent/comp semantic/wisent
semantic/wisent/wisent semantic/util-modes semantic/util semantic
semantic/tag semantic/lex semantic/fw mode-local cedet pdf-isearch
pdf-misc pdf-tools pdf-view jka-compr pdf-cache pdf-info tq 
pdf-util
pdf-macs image-mode exif notifications dbus nerd-icons-completion
nerd-icons-dired nerd-icons nerd-icons-faces nerd-icons-data
nerd-icons-data-mdicon nerd-icons-data-flicon 
nerd-icons-data-codicon
nerd-icons-data-devicon nerd-icons-data-sucicon 
nerd-icons-data-wicon
nerd-icons-data-faicon nerd-icons-data-powerline 
nerd-icons-data-octicon
nerd-icons-data-pomicon nerd-icons-data-ipsicon mynewspaper
multiple-cursors mc-separate-operations rectangular-region-mode
mc-mark-pop mc-edit-lines minimap mini-modeline face-remap lms 
iedit
iedit-lib mc-hide-unmatched-lines-mode mc-mark-more 
html-mode-expansions
sgml-mode mc-cycle-cursors multiple-cursors-core rect 
hideshow-fringe
hideshow gptel-openai-extras gptel-ollama gptel gptel-openai
google-translate-smooth-ui google-translate 
google-translate-default-ui
google-translate-core-ui facemenu ido google-translate-core
google-translate-backend expand-region text-mode-expansions
the-org-mode-expansions python-el-fgallina-expansions
er-basic-expansions expand-region-core expand-region-custom
diff-hl-flydiff diff-hl log-view log-edit message sendmail 
yank-media
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse 
rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader add-log
pcvs-util vc-dir vc vc-dispatcher epa-file epa epg rfc6068 
epg-config
colorful-mode binky-mode avy atomic-chrome websocket bindat 
let-alist
webkit-ace webkit webkit-module derived eww vtable mule-util 
url-queue
shr pixel-fill kinsoku url-file puny mm-url gnus nnheader 
gnus-util
mail-utils range mm-util mail-prsvr embark-org org-element 
org-persist
org-id org-refile org-element-ast inline avl-tree org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-src sh-script smie
executable ob-comint org-pcomplete org-list org-footnote org-faces
org-entities noutline outline ob-emacs-lisp ob-core ob-eval 
org-cycle
org-table ol org-fold org-fold-core org-keys oc org-loaddefs 
cal-menu
calendar cal-loaddefs org-version org-compat org-macs shell-pop 
term
disp-table ehelp em-tramp tramp trampver tramp-integration 
tramp-message
tramp-compat shell parse-time iso8601 time-date format-spec
tramp-loaddefs eshell esh-cmd generator esh-ext esh-proc esh-opt 
esh-io
esh-arg pcomplete esh-module esh-module-loaddefs esh-util files-x
dired-subtree dired-narrow dired-hacks-utils dired-aux dired-x 
dired
dired-loaddefs embark-consult embark ffap marginalia consult-dir 
consult
bookmark vertico-indexed vertico-multiform savehist vertico
symbol-overlay eglot external-completion jsonrpc flymake thingatpt 
diff
diff-mode track-changes ert ewoc debug backtrace find-func 
filenotify
compile text-property-search imenu dumb-jump popup dash s xref 
cape
kind-icon svg-lib color svg xml corfu-popupinfo corfu-indexed 
corfu
cus-edit pp cus-load python project compat treesit comint ansi-osc 
ring
ansi-color dom pcase kmacro advice inigo-theme easy-mmode hl-line
elec-pair recentf tree-widget wid-edit reveal delsel mb-depth comp
comp-cstr comp-run comp-common rx saveplace finder-inf info
atomic-chrome-autoloads avy-autoloads beacon-autoloads
binky-mode-autoloads calfw-cal-autoloads calfw-ical-autoloads
calfw-org-autoloads cape-autoloads colorful-mode-autoloads
consult-denote-autoloads consult-dir-autoloads corfu-autoloads
debbugs-autoloads denote-journal-autoloads 
denote-markdown-autoloads
denote-org-autoloads denote-silo-autoloads denote-autoloads
diff-hl-autoloads dired-narrow-autoloads dired-subtree-autoloads
dired-hacks-utils-autoloads dumb-jump-autoloads 
embark-consult-autoloads
consult-autoloads embark-autoloads expand-region-autoloads
expreg-autoloads focus-autoloads go-mode-autoloads
google-translate-autoloads gptel-autoloads helpful-autoloads
elisp-refs-autoloads f-autoloads htmlize-autoloads jinx-autoloads
kind-icon-autoloads ledger-mode-autoloads marginalia-autoloads
markdown-mode-autoloads mastodon-autoloads mini-modeline-autoloads
multiple-cursors-autoloads nerd-icons-completion-autoloads
nerd-icons-dired-autoloads nerd-icons-autoloads nov-autoloads
esxml-autoloads orderless-autoloads org-superstar-autoloads
pdf-tools-autoloads per-buffer-theme-autoloads persist-autoloads
popup-autoloads posframe-autoloads request-autoloads 
shell-pop-autoloads
svg-lib-autoloads symbol-overlay-autoloads tablist-autoloads
telega-autoloads tp-autoloads ts-autoloads s-autoloads 
dash-autoloads
vertico-autoloads visual-fill-column-autoloads vterm-autoloads
web-mode-autoloads websocket-autoloads wgrep-autoloads
yaml-mode-autoloads yasnippet-autoloads package browse-url xdg url
url-proxy url-privacy url-expand url-methods url-history 
url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers 
url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json 
subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-extra help-mode
warnings icons cl-loaddefs cl-lib rmc iso-transl tooltip cconv 
eldoc
paren electric uniquify ediff-hook vc-hooks lisp-float-type 
elisp-mode
mwheel term/pgtk-win pgtk-win term/common-win touch-screen 
pgtk-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list 
replace
newcomment text-mode lisp-mode prog-mode register page tab-bar 
menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse 
jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer 
nadvice seq
simple cl-generic indonesian philippine 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 emoji-zwj charscript charprop 
case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded 
button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads 
dbusbind
inotify dynamic-setting system-font-setting font-render-setting 
cairo
gtk pgtk lcms2 multi-tty move-toolbar make-network-process
tty-child-frames native-compile emacs)

Memory information:
((conses 16 1478725 958791) (symbols 48 63790 373) (strings 32 
356656 45848)
 (string-bytes 1 10452743) (vectors 16 146706) (vector-slots 8 
 2469732 617832)
 (floats 8 1987 12487) (intervals 56 30939 9636) (buffers 992 29))

-- 
Iñigo Serna