Subject: Re: bug#36032: 27.0.50; Massive GC when shift-selecting text in HELLO

From: Eli Zaretskii <[email-masked]>
Date: Sat, 01 Jun 2019 10:21:11 +0300

> Date: Fri, 31 May 2019 22:47:05 +0300
> From: Eli Zaretskii <[email-masked]>
> 
> To reproduce:
> 
>   emacs -Q
>   C-h h
>   C-SPC
>   C-f C-f C-f ....
> 
> You will see a ~0.5 sec delay after each C-f, before its effect of
> extending the region is visible.  The reason is GC after every
> keystroke, and it seems to be caused by the changes in commit 479f51a.
> That commit caused mode-line-default-help-echo to be called each time
> Emacs needs to redisplay the mode line, and that seems to produce lots
> of garbage, at least with the HELLO file.

Actually, it looks like GC is not itself the culprit, it's the fact
that by default we also compact the font caches as part of GC.  The
following patch fixes this in HELLO; any objections to push to master?
(I'm beginning to seriously think we should turn off compacting the
font caches by default, as it causes too many problems.)

diff --git a/etc/HELLO b/etc/HELLO
index a56a73b..33e664e 100644
--- a/etc/HELLO
+++ b/etc/HELLO
@@ -124,4 +124,5 @@ along with GNU Emacs.  If not, see <<https://www.gnu.org/licenses/>.
 ;;; tab-width: 32
 ;;; bidi-display-reordering: t
 ;;; coding: utf-8
+;;; inhibit-compacting-font-caches: t
 ;;; End:</x-charset>
diff --git a/lisp/files.el b/lisp/files.el
index 287ad14..35497b5 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3297,6 +3297,7 @@ safe-local-eval-forms
 	   (default-directory       . stringp)	;; C source code
 	   (fill-column             . integerp)	;; C source code
 	   (indent-tabs-mode        . booleanp)	;; C source code
+	   (inhibit-compacting-font-caches . booleanp) ;; C source code
 	   (left-margin             . integerp)	;; C source code
 	   (no-update-autoloads     . booleanp)
 	   (lexical-binding	 . booleanp)	  ;; C source code