Cargo subcommand for configuring Cargo projects for best performance.
MIT License
Cargo subcommand that applies profile and config templates to your Cargo project to configure it for maximum performance, fast compile times or minimal binary size.
I often see Rust users asking online about how can they best configure Cargo get e.g. the fastest compilation times, best runtime performance or minimal binary size. While this information can be found in various books, repositories or blog posts, it is annoying to hunt for it everytime we want to configure a new Cargo project.
This tool tries to automate that process to make it easier.
$ cargo install cargo-wizard
$ cargo wizard
$ cargo wizard apply <template> <profile>
# For example, apply `fast-runtime` template to the `dist` profile
$ cargo wizard apply fast-runtime dist
You can enable additional configuration options that require a nightly compiler by running cargo-wizard
with a
nightly Cargo (e.g. cargo +nightly wizard
) or by using the --nightly
flag.
Note that you should be executing cargo wizard
inside a directory that is a part of a Cargo workspace. It will then
apply the configuration options to that workspace.
cargo-wizard
can create or modify Cargo profiles in your Cargo.toml
manifest and RUSTFLAGS in
the .cargo/config.toml
file, based on a
set of predefined templates:
fast-compile
- minimizes compilation times
fast-runtime
- maximizes runtime performance
min-size
- minimizes binary size
fast-runtime
, but uses optimization flags designed for small binary size.You can also modify these templates in the interactive mode to build your own custom template.
cargo-wizard
mostly serves to improve discoverability of possible Cargo profile and config options, tocargo-wizard
currently only modifies Cargo.toml
and config.toml
. There are other things that can be configuredcargo-wizard
currently ignores Cargo settings that are not relevant to performance.config.toml
) changes are applied to the global build.hostflags
setting, because per-profileWhy
wizard
? The name is inspired by GUI wizards that guide you through some process using a series of dialogs.
Contributions are welcome :)
Possible future features:
toml_edit
: awesome crate that can modify TOML files while keepinginquire
: pretty slick crate for building interactive TUI dialogs and