[LLD][COFF] PDB: Parallel sort publics

Saves up to 1.3 sec on large PDBs.
Figures below are for the "Globals Stream Layout" pass:

                            Before	This patch
Large EXE (PDB is ~2 GB)	3330 ms	2022 ms
Large EXE (PDB is ~2 GB)	2680 ms	1608 ms
Large DLL (PDB is ~1 GB)	1455 ms	938 ms
Large DLL (PDB is ~800 MB)	1215 ms	800 ms
Small DLL (PDB is ~200 MB)	224 ms	146 ms

Differential Revision: https://reviews.llvm.org/D56334

llvm-svn: 350452
This commit is contained in:
Alexandre Ganea 2019-01-05 01:16:24 +00:00
parent 9f0c21c1e0
commit 383be892fc
1 changed files with 5 additions and 4 deletions

View File

@ -53,6 +53,7 @@
#include "llvm/Support/Errc.h" #include "llvm/Support/Errc.h"
#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/JamCRC.h" #include "llvm/Support/JamCRC.h"
#include "llvm/Support/Parallel.h"
#include "llvm/Support/Path.h" #include "llvm/Support/Path.h"
#include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/ScopedPrinter.h"
#include <memory> #include <memory>
@ -1387,10 +1388,10 @@ void PDBLinker::addObjectsToPDB() {
if (!Publics.empty()) { if (!Publics.empty()) {
// Sort the public symbols and add them to the stream. // Sort the public symbols and add them to the stream.
std::sort(Publics.begin(), Publics.end(), sort(parallel::par, Publics.begin(), Publics.end(),
[](const PublicSym32 &L, const PublicSym32 &R) { [](const PublicSym32 &L, const PublicSym32 &R) {
return L.Name < R.Name; return L.Name < R.Name;
}); });
for (const PublicSym32 &Pub : Publics) for (const PublicSym32 &Pub : Publics)
GsiBuilder.addPublicSymbol(Pub); GsiBuilder.addPublicSymbol(Pub);
} }