-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Cargo does not install binaries with the profiles as defined in the installed package #11599
Comments
Just looked into Cargo.toml of |
Thanks for the report! The issue is that workspace members do not pick up profiles from a workspace when published. This issue is tracked in #8264, so closing as a duplicate of that. Unfortunately I can't offhand think of a good fix (other than duplicating the profile when publishing). It would definitely be something that would be good to fix. |
Thanks for the reply. Before publishing [profile.release]
lto = "fat"
codegen-units = 1 Also I tried installing |
Thanks a lot for the link to the other issue. I will try out that fix. Could be good enough as a temporary solution. |
Just wanted to write here that the suggestion by @ehuss actually worked. |
I also checked it and tried to do these actions and publish the package, but I got Warning:
at the time of writing this message, simply copying profiles from could you tell us a little more about how you solved it? The link that gave @ehuss (#8264) just said that in the next edition the behavior of the compiler may change |
@MAKA-Rustcean I too get that warning when applying this fix and yet it works and properly applies the optimizations. I think the warning is unfortunate given the known bug. However, since this is a bug a warning is fair in order for people to rightfully get confused and eventually landing here and push awareness of this issue. :) |
@Robbepop thank you for the really useful info!!! |
The replay command wasn't working on MacOS because the HostIO symbols were striped from cargo-stylus. To fix this issue, we add a profile release to the workspace and cargo-stylus binary crate. This fixes introduces the following warning: warning: profiles for the non root package will be ignored However, there is workaround to this warning. More information here: * rust-lang/cargo#8264 * rust-lang/cargo#11599
The replay command wasn't working on MacOS because the HostIO symbols were striped from cargo-stylus. To fix this issue, we have to disable stripping in the release profile. This fixes introduces the following warning: warning: profiles for the non root package will be ignored We have to edit the profile in the non-root package because the root package is ignored during cargo install. Otherwise, the solution won't work after the package is published to crates.io. More information about this issue is available here: * rust-lang/cargo#8264 * rust-lang/cargo#11599
* Fix replay command in MacOS The replay command wasn't working on MacOS because the HostIO symbols were striped from cargo-stylus. To fix this issue, we have to disable stripping in the release profile. This fixes introduces the following warning: warning: profiles for the non root package will be ignored We have to edit the profile in the non-root package because the root package is ignored during cargo install. Otherwise, the solution won't work after the package is published to crates.io. More information about this issue is available here: * rust-lang/cargo#8264 * rust-lang/cargo#11599 * Fix missing symbols in MacOS Add #[used] static variables pointing to the exported functions so the linked doesn't remove them from the final binary. * Revert "Fix replay command in MacOS" This reverts commit b489394.
Problem
Today I released a CLI tool for my Wasm interpreter: https://crates.io/crates/wasmi_cli
The entire tool depends heavily on the right Cargo profile to be used during compilation, namely:
Otherwise we see performance regressions of 50%-400%.
Cargo docs state that the
--release
profile is used by default for installs.However, when installing the
wasmi
CLI tool viacargo install wasmi_cli
and then benchmark it against a local buildcargo run --release --package wasmi_cli -- etc..
I see very big differences in performance which leads me to the guess that Cargo does not apply the proper profiles to installed crates but uses the default configurations instead.This bug is critical to the performance of the
wasmi
CLI application.Steps
wasmi_cli
viacargo install wasmi_cli
wasmi
repository:git clone https://github.com/paritytech/wasmi.git
wasmi
repository:cd wasmi
wasmi
CLI tool:time wasmi_cli ./crates/wasmi/benches/wat/fibonacci.wat fib_iterative 100000000
time cargo run --package wasmi_cli --profile bench ./crates/wasmi/benches/wat/fibonacci.wat fib_iterative 100000000
Observe that step 4. takes way more time than step 5.
Works with other examples as well.
For example using the recursive version of fibonacci:
./crates/wasmi/benches/wat/fibonacci.wat fib_recursive 40
Possible Solution(s)
Cargo should use the profiles as defined in the installed package and not the default settings.
Notes
How did I know that this is probably because Cargo uses the default
release
settings for installation? I simply compiled the repositorywasmi_cli
via the defaultrelease
settings and then both performed equally bad.Version
The text was updated successfully, but these errors were encountered: