Re: Deferring native compilation finalization until idle

Eli Zaretskii <[email protected]> Sat, 25 Jul 2026 19:32:11 +0300
Newsgroups gmane.emacs.devel
Message-ID <[email protected]>
> Date: Sat, 25 Jul 2026 15:56:52 +0000
> From: "Aaron Jensen" <[email protected]>
> Cc: Stéphane Marks <[email protected]>, "Eli Zaretskii"
>  <[email protected]>, [email protected], [email protected], [email protected]
> 
> I'm afraid that the notion that this is a CPU saturation problem is demonstrably false as well.

If the reason is macOS validation of the *.eln files being loaded,
then CPU saturation is not relevant at all: the validation most
probably runs in the same thread as the one Emacs uses to load the*.eln
files, because the validation most probably intercepts the system
calls that load shared libraries.


> My suggested change was to move the first load to actually be asynchronous.

That would mean Emacs will be unable to use the native code until it
is loaded at some future time.  IOW, this comes with some performance
hit, which the current code avoids.  Therefore, I would like to
introduce this complication only if the problem is wide enough, and
even then only on macOS.  Please be more patient.

>    codesign --force --sign - \
>        --entitlements macos-disable-library-validation.entitlements \
>        src/emacs
> 
>  Are you using that?
> 
> If the Jimeh build uses this, it didn't work for me. Regardless, this is exactly the thing that disables the security
> check macOS is doing. It is certainly a "workaround". And it does, in fact, prevent the stutter. If you're doing this
> (or your build is) and you're not seeing problems, that explains it completely. It seems somewhat strange to say
> "I'm already doing the workaround and I don't have the problem!", so I'm not sure exactly what you're getting at
> here. Without disabling validation, this *is a main thread problem* because the entirety of macOS compilation +
> validation is *not* done asynchronously.

TBH, I don't understand why that validation is need for *.eln files.
Those are compiled on your machine, so what validation is necessary?
It's not like you download unknown binaries from somewhere.