How to decrease the size of binary? #1925
-
Bug ReportVersion[dependencies]
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = [
"fmt",
"env-filter",
"local-time",
] } PlatformMacOS DescriptionWithout tracingmain.rs fn main() {
println!("Hello, world!");
}
Tracing Without EnvFiltermain.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 EnvFiltermain.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* |
Beta Was this translation helpful? Give feedback.
Answered by
davidbarsky
Feb 14, 2022
Replies: 1 comment
-
There are several ways to reduce the size of a Rust binary. johnthagen/min-sized-rust is a good resource to start with. In the case of tracing with tracing-subscriber and Does that answer your question or are you asking about something else? |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lz1998
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are several ways to reduce the size of a Rust binary. johnthagen/min-sized-rust is a good resource to start with.
In the case of tracing with tracing-subscriber and
EnvFilter
, tracing-subscriber is a large crate andEnvFilter
pulls in theregex
crate. If you don't need all the features ofEnvFilter
, you can make use ofTargets
.Does that answer your question or are you asking about something else?