Skip to content

How to decrease the size of binary? #1923

@lz1998

Description

@lz1998

Bug Report

Version

[dependencies]
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = [
    "fmt",
    "env-filter",
    "local-time",
] }

Platform

MacOS

Description

Without tracing

main.rs

fn main() {
    println!("Hello, world!");
}
cargo build --release
cd target/release && ll

-rwxr-xr-x   2 lz1998  staff   441K Feb 13 16:51 untitled1*

Tracing Without EnvFilter

main.rs

fn main() {
    println!("Hello, world!");
    tracing_subscriber::fmt()
        .without_time()
        .init();
    tracing::info!("hello");
}
cargo build --release
cd target/release && ll

-rwxr-xr-x   2 lz1998  staff   719K Feb 13 16:50 untitled1*

Tracing With EnvFilter

main.rs

fn main() {
    println!("Hello, world!");
    let env = tracing_subscriber::EnvFilter::from("");
    tracing_subscriber::fmt()
        .with_env_filter(env)
        .without_time()
        .init();
    tracing::info!("hello");
}
cargo build --release
cd target/release && ll

-rwxr-xr-x   2 lz1998  staff   1.8M Feb 13 16:44 untitled1*

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions