How can I profile linking?

I'm debugging why a package I'm working on has very long compile times (unfortunately it isn't open source so I cannot share it here), so I ran cargo build --timings and the report it generated showed that it spends about 1 minute on compiling the dependencies, and 7 minutes on linking.

  1. A 7:1 ratio of linking to compiling seems pretty huge. I would have thought that there would be some kind of linear-ish correlation between compiling and linking times. Am I wrong?
  2. Is there any way I can profile the linking step itself to see what's taking so long?

On linux mold can make linking much faster.

GitHub - rui314/mold: Mold: A Modern Linker 🦠

Yep, thanks! I'm more interested in figuring out how to profile this so I can understand why it's taking so long with the standard linker though.

@fasterthanlime has a relevant post!

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.