Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large binary size with default tracing handlers #342

Closed
phu-cinemo opened this issue Mar 20, 2023 · 1 comment
Closed

Large binary size with default tracing handlers #342

phu-cinemo opened this issue Mar 20, 2023 · 1 comment
Labels
C-enhancement Category: A PR with an enhancement or a proposed on in an issue. E-help-wanted Call for participation: Help is requested to fix this issue. E-medium Call for participation: Experience needed to fix: Medium / intermediate

Comments

@phu-cinemo
Copy link

The binary size of the default OnResponse::on_response implementation seems rather excessive.
Even for a release build with fat-lto enabled, it ends up taking ~68KiB according to cargo-bloat.

We can't use a custom handler easily, because we rely on gRPC status handling.

If DefaultOnResponse cannot become smaller, maybe the machinery for gRPC handling could be exposed?

(this is also true for OnEos, but to a lesser extent.)

@davidpdrsn davidpdrsn added C-enhancement Category: A PR with an enhancement or a proposed on in an issue. E-help-wanted Call for participation: Help is requested to fix this issue. E-medium Call for participation: Experience needed to fix: Medium / intermediate labels Mar 20, 2023
@erebe
Copy link
Contributor

erebe commented Aug 18, 2023

Issue can be closed since #380 is merged and released in v0.4.3.

❯ cargo bloat --release -n 10
 File  .text    Size                 Crate Name
 0.3%   0.9% 46.5KiB                brotli brotli::enc::block_splitter::BrotliSplitBlock
 0.3%   0.8% 42.7KiB tonic_key_value_store tonic_key_value_store::main::{{closure}}
 0.3%   0.8% 42.4KiB tonic_key_value_store tonic_key_value_store::main::{{closure}}
 0.2%   0.6% 32.3KiB                    h2 h2::codec::framed_read::decode_frame
 0.2%   0.6% 30.3KiB                brotli brotli::enc::backward_references::BrotliCreateBackwardReferences
 0.2%   0.6% 28.0KiB                brotli brotli::enc::brotli_bit_stream::LogMetaBlock
 0.2%   0.5% 26.2KiB          clap_builder clap_builder::parser::parser::Parser::get_matches_with
 0.2%   0.4% 22.8KiB                   std addr2line::ResDwarf<R>::parse
 0.1%   0.4% 19.9KiB                   std std::backtrace_rs::symbolize::gimli::resolve::{{closure}}
 0.1%   0.4% 18.1KiB                 hyper <hyper::proto::h1::role::Server as hyper::proto::h1::Http1Transaction>::encode
32.3%  92.1%  4.6MiB                       And 12524 smaller methods. Use -n N to show more.
35.1% 100.0%  5.0MiB                       .text section size, the file size is 14.1MiB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: A PR with an enhancement or a proposed on in an issue. E-help-wanted Call for participation: Help is requested to fix this issue. E-medium Call for participation: Experience needed to fix: Medium / intermediate
Projects
None yet
Development

No branches or pull requests

3 participants