RazrFalcon / cargo-bloat

Find out what takes most of the space in your executable.
MIT License
2.31k stars 50 forks source link

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

Open stepancheg opened 6 years ago

stepancheg commented 6 years ago

Group by

Currently cargo bloat support grouping by:

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

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:

# 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 commented 6 years ago

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 commented 6 years ago

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.

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 commented 6 years ago

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 commented 6 years ago

Filtering was added in the v0.5