Subject: bug#79021: 31.0.50; Unnecessary GC in after-load-functions

From: Daniel Colascione <[email-masked]>
Date: Fri, 12 Sep 2025 04:00:35 -0700

On September 12, 2025 3:39:39 AM PDT, Eli Zaretskii <[email-masked]> wrote:
>> Date: Fri, 12 Sep 2025 01:01:52 -0700
>> From: Daniel Colascione <[email-masked]>
>> CC: [email-masked], [email-masked]
>> 
>> >> -(add-hook 'after-load-functions (lambda (_) (garbage-collect)))
>> >> +;;
>> >> +;; This was probably done to reduce fragmentation with unexec.  With the
>> >> +;; pdumper it makes little sense.  See bug#79021.
>> >> +(if (not (fboundp 'dump-emacs-portable))
>> >> +    (add-hook 'after-load-functions (lambda (_) (garbage-collect))))
>> >
>> >Are we sure the problem no longer happens with pdumper?  Daniel, WDYT?
>> >
>> 
>> It's unnecessary with pdumper, which compacts automatically.
>
>Thanks.
>
>> >In any case, the fboundp test is not enough, we should test the value
>> >of dump-mode instead, I think.  Because Emacs might be built with
>> >pdumper support, but this session is not going to call
>> >dump-emacs-portable, due to command-line options or some other trick.
>> 
>> Just delete it.
>
>It's still useful if starting undumped Emacs, no?

I don't think so. It wouldn't be any more useful than it would be in regular Emacs: GC doesn't differ between a dumped and an undumped Emacs, meaning the code above would be good in both or neither. Since we don't have a theory of why it would be useful in any circumstance post-unexec and have data showing it's a pessimization, let's just delete it and take the complexity reduction win.