-
Notifications
You must be signed in to change notification settings - Fork 848
Open
Description
Comparing to the log crate, tracing is so powerful and elegant. However, tracing also brings more binary size to the application due to the more complex expanded macro codes. I have a simple binary size test against tracing and log.
Here is the source code. For 1k lines of info!("Hello World!"); macro called, tracing is nearly 2x larger binary size than the log (in release mode, w/o strip).
$ ls -l target/release/tracing target/release/log
-rwxr-xr-x 2 xx staff 567848 Jun 7 21:35 target/release/log
-rwxr-xr-x 2 xx staff 1137672 Jun 7 21:36 target/release/tracing
P.S. We recently replaced the log with tracing in our company project. What overwhelmed us is that we got 10 Mib large size than before! 😲
Proposal
Optimize the binary size without comprising the features, elegance, and performance.
I only have few thoughts right now:
- I don't think the
namefield ofMetadatais useful to theEvent, neither thefile,line, andmodule_pathare useful to theSpan? We really need to share the sameMetadatastruct forEventandSpan? - Seems like we have a lot of discusses on whether we deserve the
levelfield forSpan, I still in favor of level-lessSpan. I believe this can reduce the complexity and is beneficial to binary size.
Alternative
Maybe we can have a tracing-lite crate, which is binary size friendly but missing some features?
jirutka and ogios
Metadata
Metadata
Assignees
Labels
No labels