Is there a way to list the top biggest libraries that my app depend on?
I would like to reduce the full compilation time of my app by removing its biggest dependencies. I suspect some of them aren’t needed anymore, but there are so many libraries that I can’t afford to analyze one by one. So I would like to start from the biggest.
File size does not always correlate to compile times, but here’s a quick and dirty script that sorts each dependency by the total file size of the ex and erl files.
Given that Elixir macros mean there can be arbitrary code execution at compile time, size of library (in lines of code) is an unreliable predictor of compile time.
In addition, since dependencies are compiled once I’m not sure that you will gain any material compile time improvements due to pruning (assumes you are caching dependencies in CI).
I have never once used them but since 1.11 Elixir has compiler tracers that could allow you to e.g. track which dependency takes longest to compile – if that’s the problem you are solving for.
Though I really think we have an XY problem here and you should give us an idea of your project’s structure so we can help you reduce compilation time or a runtime bottleneck.