-
-
Notifications
You must be signed in to change notification settings - Fork 726
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
dx build --release
doesn't read the [profile.release]
table from Cargo.toml
(strip
doesn't work)
#2352
Comments
Dioxus doesn't read or modify your Do you see a change in binary size when building with cargo directly? |
I didn't try the cargo-direct method, only with/without env var and config changes. |
Hmm, the data is kinda confusing:
The one thing that stands out is the |
We use The difference between strip and no strip in dioxus and cargo seems pretty similar (-162040 in dx) (-157944 in cargo) so this doesn't seem like a bug in dioxus. If you would like to minimize the size of your release binary, there are several other settings you can add to your [unstable]
build-std = ["std", "panic_abort", "core", "alloc"]
build-std-features = ["panic_immediate_abort"]
[build]
rustflags = [
"-Clto",
"-Zvirtual-function-elimination",
"-Zlocation-detail=none"
]
# Same as in the Stable section
[profile.release]
opt-level = "z"
debug = false
lto = true
codegen-units = 1
panic = "abort"
strip = true
incremental = false When building with nightly and those settings, the tailwind desktop bundle goes from ~5mb to ~2mb for a macOS ARM Closing this issue as not reproducable |
Is this code inserted in the resulting binary? Or is this code from the So, if I don't set any names programmatically, then the only difference between two building methods is just a few embedded strings? Like, is it typically safe to use cargo instead of dx to build things? |
The JSON string is compiled into the binary. It could also trigger more code in dioxus desktop to get included into the final binary because the settings in the dioxus.toml are applied
Yes, you can typically use cargo instead of dx if you want to. Just keep in mind, not all of the settings in your |
I was able to reduce file size from 6.6 MiB to 2.9 MiB! Though this is great, the unfortunate part is that the full startup time has not been decreased. It still says at about 1.1 s (versus 0.8 s for the default Desktop + TailwindCSS project). |
So you probably can add a |
Yes, we have tried to include different parts of the CLI like hot reloading and asset compression in the application or a macro before, but it ends up performing poorly because macros and build scripts run in debug mode and don't persist between recompiles |
Hmm, ok, good to know. Thanks! |
Problem
strip
setting for release profile doesn't change the binary's file size, even though I checked the docs (and this) and it should change the binary even if by a few bytes. But it doesn't work. Or maybe normally doesn't work (I think once it did change something, but maybe not). It only works viaRUSTFLAGS='-C strip=symbols'
.Steps To Reproduce
Steps to reproduce the behavior:
dx new
(Desktop+Tailwind)cd project_name
Cargo.toml
:dx build -r
du -b ./dist/binary_name
)strip
's value as the binary's size shouldn't changeRUSTFLAGS='-C strip=symbols'
will apply the correctstrip
levelExpected behavior
strip
setting for release profile should change binary's file size.Environment:
Questionnaire
The text was updated successfully, but these errors were encountered: