Here is a simple demo:
#[macro_use] extern crate log;
extern crate fern;
fn main() {
fern::Dispatch::new()
.level(log::LevelFilter::Warn)
.chain(std::io::stderr())
.apply().unwrap();
warn!("Hello, world!");
// println!("Hello, world!");
test();
}
fn test() {
warn!("Hello, world!");
// println!("Hello, world!");
}
According to the cargo-bloat, the code size with warn in the release build is 1000B and with println - 717B. Why it impacts the size so much? Maybe this is a cargo-bloat bug (yes, I'm the author)?
In the real world applications, the results are even more drastic. For example, if I remove all the logging from this module the size in the release build will be reduced from 9.1KiB to 3.1KiB. It's ridiculous.
I this is a correct behavior or am I missing something?
log v0.4.1
fern v0.5.5
cargo-bloat v0.5.0
rustc 1.26.1
Here is a simple demo:
According to the
cargo-bloat, the code size withwarnin the release build is 1000B and withprintln- 717B. Why it impacts the size so much? Maybe this is acargo-bloatbug (yes, I'm the author)?In the real world applications, the results are even more drastic. For example, if I remove all the logging from this module the size in the release build will be reduced from 9.1KiB to 3.1KiB. It's ridiculous.
I this is a correct behavior or am I missing something?
log v0.4.1
fern v0.5.5
cargo-bloat v0.5.0
rustc 1.26.1