Skip to content
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

Add zng-template notes #594

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions docs/optimize-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ Note that you may need some external dependencies to build the `"view"` feature.
To quickly find what features your app is actually using you can temporary set `default = ["release"]` and `cargo run`, the rustc error messages
usually show missing features.

[`zng-template`]: https://github.com/zng-ui/zng-template

## LTO and Codegen Units

The compiler has some parallelism by default to speedup compilation, you can configure the release profile to compile as a single unit
Expand Down Expand Up @@ -75,6 +73,8 @@ release = [
opt-level = "z" # instruct the compiler to optimize for size
```

Note that the [`zng-template`] already setups something like this, you just need to fill in the release features on each crate and call `cargo do build-r -z`.

### Nightly

If your project safety constraints allows the nightly compiler and an unstable feature you can enable `-Zshare-generics` to reduce size even more:
Expand All @@ -94,4 +94,8 @@ In the command line example above the `RUSTFLAGS` is set to enable the `share-ge

The example also sets the `-C link-args=-znostart-stop-gc`, this is to workaround a nightly only linker issue that affects a dependency of `zng`. Note
that every nightly release can cause all kinds of issues and the `zng` project is only officially supported on the latest stable Rust release. This
optimization was tested on the `2025-01-08` nightly release.
optimization was tested on the `2025-01-08` nightly release.

The [`zng-template`] already setups something like this, call `cargo do build -r -z --bleed` to compile with nightly optimizations.

[`zng-template`]: https://github.com/zng-ui/zng-template
Loading