I am working on a LLD bug "Bug 32228 - -gdb-index is too slow".
One of place I want to start from is a proccessing of relocations. It is usually
a hot place. I noticed that relocations that are proccessed in DWARFContextInMemory often uses
the same symbol in a row.
I took debug LLC binary objects configured with -ggnu-pubnames and linked it using LLD.
- Link time without --gdb-index is about 4,45s.
- Link time with --gdb-index: a) Without patch: 19,16s b) With patch: 15,52s
That means time spent on --gdb-index in this configuration is
19,16s - 4,45s = 14,71s vs 15,52s - 4,45s = 11,07s.
Total time change spent on building index then is 11,07s/14,71 = 0,7525