-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lightweight Flake #7
Conversation
Mmh. It seems I broke MacOS. Is there a good way to test it? |
[profile.release] | ||
codegen-units = 1 | ||
opt-level = "s" | ||
lto = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing LTO from the build options cuts build times in half for no apparent downside.
Here are my measurements:
- 1.82.0-nightly + existing codegen options : 20,91s
- 1.82.0-nightly + default codegen options : 11,39s
- 1.80.1 (stable) + existing codegen options: 20,77s
- 1.80.1 (stable) + default codegen options : 11.85s
I agree that there is a benefit. Further, I verified that opt-level = "s"
only saves 300K, although not impacting build times. As the micro optimization really isn't that important and it apparently solves problems for you, I'm fine with the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
The Rust overlay is very large, because it carries information about all possible Rust toolchain versions. This is sometimes useful, but this tool builds fine with the Rust version in Nixpkgs. This change reduces the stuff that users have to download quite a bit. Not only is there now rust-overlay tarball to download, you also use the default Rust toolchain, which is probably already somewhere on disk!
There is no need to micro-optimize the binary. Removing LTO from the build options cuts build times in half for no apparent downside. I've also removed the strippping, because the Cargo manual advices against it for proper backtraces.
The MacOS build fails with: > ++ command cargo build --release --message-format json-render-diagnostics --locked > Compiling gitlab-timelogs v0.2.2 (/private/tmp/nix-build-gitlab-timelogs-0.2.2.drv-0/8bm81sjfqmsk7lclw7pnddrxv785aaj3-source) > error: linking with `cc` failed: exit status: 1 Fix by manually adding iconv as a dependency. Other people also have encountered this: nix-community/home-manager#3482
819117d
to
f7c665e
Compare
This PR intends to make the flake more lightweight. 🪶
rust-overlay
because the default Rust toolchain is good enough andrust-overlay
is large.Please take a look at the commit messages for more information.