NovFora Dev

**Thread ** Why my Rust binary size exploded after adding tokio — debugging this now

Taylor Davis

Taylor Davis

4 months ago

Adding tokio to a CLI tool bumped my static binary from ~40KB to over 5MB on a simple JSON parser. I suspect it's pulling in the full multi-threaded runtime when I only need single-thread or even just std::thread for this use case. Has anyone managed to cherry-pick tokio features effectively? The full feature flag seems like overkill and is clearly dragging in networking, file IO, signal handling, and synchronization primitives I don't need. My plan is to switch to a minimal feature set — perhaps rt with the single cfg instead of multi since this isn't a high-concurrency server. Should also consider whether tokio is actually necessary here or if std::thread would suffice for this workload. Any experience getting tight binary sizes while still using async?

Join the conversation to leave a reply.

Sign in to reply

Related topics