Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding link time bottlenecks

Tags:

c++

linker

A question I haven't seen answered that I'm finding very interesting. All the other threads seems to discuss forcing the problem, ie switching to dynamic linking or just distributing the workload. I'm more interested in actually finding out what's causing linking to take so long.

The problem is that I don't really see any official ways to get the relevant metrics from the linker, at least not for the VS linker. There's the /verbose switch which will give you a lot of insight into what the linker is doing, but it won't give you any fine grained timings at all.

I've been thinking of running the linker process from a tool which do the actual measurements on a per line basis. While this won't provide accurate timings, it would probably be accurate enough to pinpoint linking bottlenecks.

Anyone know of a better approach, or perhaps even a tool for this task?

like image 223
Ylisar Avatar asked Sep 22 '10 11:09

Ylisar


2 Answers

Found an excellent article series on this on http://gameangst.com/?p=46 , which goes into rather fine detail on what affects link times. At the end the author also supplies a program that he calls symbol sort ( at http://gameangst.com/?p=320 ). This is the program I was looking for, as it greatly aids in pinpointing where to spend your effort. It doesn't hurt that it took about 10 seconds to get it up and running and working!

like image 178
Ylisar Avatar answered Sep 17 '22 13:09

Ylisar


Although not directly answering your question:

In VS the linker is also responsible for code generation and global optimization, you may try to disable "Link Time Code Generation" to decrease link time.

EDIT: Thus, due to the global nature of the linker you can't say that linking module X takes 10% of the time.

like image 23
Yakov Galka Avatar answered Sep 21 '22 13:09

Yakov Galka