This is an archive of the discontinued LLVM Phabricator instance.

Parallelize GdbIndexSection's symbol table creation.
ClosedPublic

Authored by ruiu on Jul 10 2018, 5:50 PM.

Details

Summary

Since .gdb_index sections contain all known symbols, they can be very large.
One of my executable has a .gdb_index section of 1350 GiB. Uniquifying
symbols by name takes 3.77 seconds on my machine. This patch parallelize it.

Time to call createSymbols() with 8.4 million unique symbols:

Without this patch: 3773 ms
Parallelism = 1:    4374 ms
Parallelism = 2:    2628 ms
Parallelism = 16:    837 ms

As you can see above, this algorithm is a bit more inefficient
than the non-parallelized version, but even with dual-core, it is
faster than that, so I think it is overall a win.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

ruiu created this revision.Jul 10 2018, 5:50 PM
ruiu updated this revision to Diff 154964.Jul 11 2018, 3:59 AM
  • rebased
grimar accepted this revision.Jul 11 2018, 4:15 AM

LGTM.

lld/ELF/SyntheticSections.cpp
2372 ↗(On Diff #154964)

MergeNoTailSection has NumShards == 32, I wonder why 16 here?

This revision is now accepted and ready to land.Jul 11 2018, 4:15 AM
ruiu added inline comments.Jul 11 2018, 4:35 AM
lld/ELF/SyntheticSections.cpp
2372 ↗(On Diff #154964)

No particular reason. Will change to 32. Due to diminishing return, 16 and 32 wouldn't be that different though.

This revision was automatically updated to reflect the committed changes.