Skip to content

emacs: enable native-comp#176780

Merged
lheckemann merged 1 commit intoNixOS:masterfrom
linj-fork:emacs-native-comp
Aug 19, 2022
Merged

emacs: enable native-comp#176780
lheckemann merged 1 commit intoNixOS:masterfrom
linj-fork:emacs-native-comp

Conversation

@jian-lin
Copy link
Contributor

@jian-lin jian-lin commented Jun 7, 2022

Description of changes

cc @adisbladis

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@jian-lin jian-lin requested a review from adisbladis as a code owner June 7, 2022 18:45
@github-actions github-actions bot added 6.topic: emacs Text editor 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation labels Jun 7, 2022
@jian-lin jian-lin mentioned this pull request Jun 7, 2022
13 tasks
@ofborg ofborg bot added the 8.has: clean-up This PR removes packages or removes other cruft label Jun 7, 2022
@ofborg ofborg bot requested review from jwiegley and lovek323 June 7, 2022 18:52
@ofborg ofborg bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Jun 7, 2022
@azahi
Copy link
Member

azahi commented Jun 8, 2022

Result of nixpkgs-review pr 176780 run on x86_64-linux 1

2 packages built:
  • emacs
  • emacs-nox

@bobby285271 bobby285271 added the 12.approvals: 2 This PR was reviewed and approved by two persons. label Jun 10, 2022
@alyssais alyssais added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 27, 2022
@jian-lin jian-lin force-pushed the emacs-native-comp branch from d94146a to 0496970 Compare August 6, 2022 05:37
@jian-lin jian-lin removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Aug 6, 2022
@bobby285271 bobby285271 removed the 12.approvals: 2 This PR was reviewed and approved by two persons. label Aug 12, 2022
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we want this? Wouldn't it have performance benefits to leave this enabled?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When someone has lots of packages from ELPA, then after launching Emacs it will try to compile all of these packages which is quite heavy on CPU. I agree with the author of the PR that it is better to make the native compilation for user packages opt-in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting this line (setq native-comp-deferred-compilation nil) does have performance benifits but users will need some compilation if they install packages not from nixpkgs. (You can see the release notes for more information about this).

Some users don't want that compilation:

@wahjava wrote in #168076 (comment)

it uses 100% CPU (in its default configuration) when you install any new packages for native compilation

I set native-comp-deferred-compilation to nil in this pr to have less impact on users. However, I would love to remove this line (setq native-comp-deferred-compilation nil) and instead add instructions that users don't want this can set (setq native-comp-deferred-compilation nil) in their init file, like what @axelf4 said and @adisbladis agreed in #168076:

Would not those users be better off disabling just-in-time native compilation in their init files, while still benefiting from the packaged Emacs distribution being ahead-of-time compiled?

What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I prefer not setting this. Everything else in this file looks like me to distro-compatibility code, which I think is a lot more appropriate for us to decide on, as opposed to user preferences, which I think should be left to upstream (for defaults) and, well, the users :)

I think removing it but suggesting it to users in the release notes would be good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding upstream's default, one may argue that upstream does not enable native-comp by default. However, since this change is mentioned in the release notes, it should be fine.

@lheckemann What you suggested has been done.

@lheckemann
Copy link
Member

Also, I've had problems building emacs packages on aarch64 in the past, package builds would crash. Let's run a couple packages through ofborg to make sure this is fixed, and if not only enable it on x86 by default.

@ofborg build emacsPackagesNg.magit emacsPackagesNg.counsel emacsPackagesNg.vterm

@lheckemann
Copy link
Member

That looks fine, so that only leaves the async question :) the reason should probably be documented in the release notes which we already have.

@jian-lin jian-lin changed the title emacs: enable native-comp and disable async deferred native-comp emacs: enable native-comp Aug 18, 2022
@lheckemann
Copy link
Member

Hm, I'm sure I made another comment in here somewhere improving the wording of the release notes. Never mind though, let's just merge this and get the functionality in.

@lheckemann lheckemann merged commit d167d23 into NixOS:master Aug 19, 2022
@jian-lin jian-lin deleted the emacs-native-comp branch August 19, 2022 10:06
hpfr added a commit to hpfr/system that referenced this pull request Oct 8, 2022
The default Emacs package uses native-comp by default as of
NixOS/nixpkgs#176780
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: emacs Text editor 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: clean-up This PR removes packages or removes other cruft 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants