emacscollective / auto-compile

Automatically compile Emacs Lisp libraries
GNU General Public License v3.0
172 stars 16 forks source link

Support native compilation when available (Emacs 28 and libgccjit installed) #25

Closed sfllaw closed 3 years ago

sfllaw commented 3 years ago

When native compilation is available, (and (fboundp 'native-comp-available-p) (native-comp-available-p))), use native-compile instead of packed-byte-compile-file.

Auto-compile should provide a auto-compile-function that defaults to native compilation when available, but falls back to the old function.

tarsius commented 3 years ago

I was planning something like that eventually but haven't done so yet because I think this is not as trivial as you make it out to be and will require some thought. E.g. we might want to do it asynchronously because we do it on every save. Byte-compile first in that case? Should it work differently during load than during save? ...

I definitely plan to have this ready by the time a nativecomp powered Emacs is due to be released, but might delay working on this until that release gets closer. You can redefine packed-byte-compile-file if you desperately need this now.

sfllaw commented 3 years ago

@tarsius Fair enough! I didn’t check if running packed-byte-compile-file on save was a good enough experience. If it is slow, then I agree that it might make sense to do this asynchronously.

tarsius commented 3 years ago

I've added an option to enable this but I recommend against enabling it as explained in the doc-string.