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

Group by without type parameters; filter by regular expression #19

Open
stepancheg opened this issue May 22, 2018 · 4 comments
Open

Group by without type parameters; filter by regular expression #19

stepancheg opened this issue May 22, 2018 · 4 comments

Comments

@stepancheg
Copy link

Group by

Currently cargo bloat support grouping by:

  • crate
  • full symbol

I think it would be helpful it cargo bloat could also group by:

  • function without type parameters

I think that's important because I have lots of symbols like:

 0.1%   0.3%  9.2KiB         protobuf <protobuf::descriptor::FileOptions as protobuf::core::Message>::merge_from
 0.1%   0.2%  7.7KiB         protobuf <protobuf::descriptor::FileOptions as protobuf::core::Message>::write_to_with_cached_sizes
 0.1%   0.2%  6.9KiB         protobuf <protobuf::descriptor::FileDescriptorProto as protobuf::core::Message>::merge_from

It would be useful to sum all protobuf::core::Message::merge_from functions and find next largest generic bloated function.

Filtering

Currenly cargo bloat supports filtering by crate.

I might be helpful to:

  • filter by regular expression
# cargo bloat --filter-re 'FieldDescriptorProto`

Find all symbols containing substring FieldDescriptorProto, display top 20 of them, display size sum of all symbols, and total size as usual.

@RazrFalcon
Copy link
Owner

Group by

You want an additional flag that will merge generic methods and traits? The data required for such merging doesn't even parsed now, so it will take some time to implement.

Filtering

I'm using grep for this at the moment. But yes, the current filter doesn't sum up the filtered data.

@stepancheg
Copy link
Author

You want an additional flag that will merge generic methods and traits?

Yes, an additional flag that will merge all instantiations all generic functions/methods together.

E. g.

  • merge all HashMap<K, V>::new together to key std::collections::hash::map::HashMap::new
  • and merge all Vec<T>::extend::<I> together to key core::iter::traits::Extend::extend

The data required for such merging doesn't even parsed now, so it will take some time to implement.

OK. I can try to implement it.

Filtering
I'm using grep for this at the moment. But yes, the current filter doesn't sum up the filtered data.

Like cargo bloat -n 9999999999 | grep re | head -20? That works, but having a flag is probably slightly more convenient.

@RazrFalcon
Copy link
Owner

I can try to implement it.

Well, basically I need a Rust symbol parser. And such a library doesn't exist at the moment. I planned to write it myself, but I don't have enough time.

-n 9999999999

You can use -n 0.

@RazrFalcon
Copy link
Owner

Filtering was added in the v0.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants