4 ms·
I am just a college student, so sorry if this is stupid, but we know that Rust compiler can detect unused code, variables, functions and all, as can IDE's for a
by akshitgaur2005 1y ago
I am just a college student, so sorry if this is stupid, but we know that Rust compiler can detect unused code, variables, functions and all, as can IDE's for all languages, then why don't we just remove those parts? The unused code is just not compiled.
- whstl 1y agoMainly because in some libs some code is activated at runtime. A lot of the bloat comes from functionality that can be activated via flags, methods that set a variable to true, environment variables, or even via configuration files.
- stevenhuang 1y agoWhen talking about LTO we don't expect it to be removing code used in runtime. Such code is not dead code, by definition. If you want to disable certain runtime features, you'd do so with feature flags.
- whstl 1y agoSure, but I'm talking about bloat in libraries that don't get LTO'd. If there are no feature flags and no plugin functionality, LTO can't do its job. There are plenty of non-core libraries like this.