llvm-project/llvm/lib/DebugInfo/PDB/Native
Reid Kleckner 6529d7c5a4 [PDB] Defer relocating .debug$S until commit time and parallelize it
This is a pretty classic optimization. Instead of processing symbol
records and copying them to temporary storage, do a first pass to
measure how large the module symbol stream will be, and then copy the
data into place in the PDB file. This requires defering relocation until
much later, which accounts for most of the complexity in this patch.

This patch avoids copying the contents of all live .debug$S sections
into heap memory, which is worth about 20% of private memory usage when
making PDBs. However, this is not an unmitigated performance win,
because it can be faster to read dense, temporary, heap data than it is
to iterate symbol records in object file backed memory a second time.

Results on release chrome.dll:
peak mem: 5164.89MB -> 4072.19MB (-1,092.7MB, -21.2%)
wall-j1:  0m30.844s -> 0m32.094s (slightly slower)
wall-j3:  0m20.968s -> 0m20.312s (slightly faster)
wall-j8:  0m19.062s -> 0m17.672s (meaningfully faster)

I gathered similar numbers for a debug, component build of content.dll
in Chrome, and the performance impact of this change was in the noise.
The memory usage reduction was visible and similar.

Because of the new parallelism in the PDB commit phase, more cores makes
the new approach faster. I'm assuming that most C++ developer machines
these days are at least quad core, so I think this is a win.

Differential Revision: https://reviews.llvm.org/D94267
2021-01-12 17:46:29 -08:00
..
DbiModuleDescriptor.cpp
DbiModuleDescriptorBuilder.cpp [PDB] Defer relocating .debug$S until commit time and parallelize it 2021-01-12 17:46:29 -08:00
DbiModuleList.cpp
DbiStream.cpp
DbiStreamBuilder.cpp [PDB] Defer relocating .debug$S until commit time and parallelize it 2021-01-12 17:46:29 -08:00
EnumTables.cpp
GSIStreamBuilder.cpp fix typos to cycle bots 2020-12-12 20:19:33 -05:00
GlobalsStream.cpp
Hash.cpp
HashTable.cpp
InfoStream.cpp
InfoStreamBuilder.cpp
InjectedSourceStream.cpp
ModuleDebugStream.cpp
NamedStreamMap.cpp [DebugInfo] Use llvm::append_range (NFC) 2021-01-04 11:42:45 -08:00
NativeCompilandSymbol.cpp
NativeEnumGlobals.cpp
NativeEnumInjectedSources.cpp
NativeEnumLineNumbers.cpp [NativeSession] Implement findLineNumbersByAddress in NativeSession, 2020-06-15 17:05:39 -07:00
NativeEnumModules.cpp
NativeEnumSymbols.cpp [llvm-symbolizer] Add inline stack traces for Windows. 2020-11-17 13:19:13 -08:00
NativeEnumTypes.cpp
NativeExeSymbol.cpp
NativeFunctionSymbol.cpp [llvm-symbolizer] Fix native symbolization on windows for inline sites. 2020-11-30 14:27:35 -08:00
NativeInlineSiteSymbol.cpp [llvm-symbolizer] Add inline stack traces for Windows. 2020-11-17 13:19:13 -08:00
NativeLineNumber.cpp [PDB][NativeSession] Clean up some things in NativeSession. 2020-07-21 16:54:52 -07:00
NativePublicSymbol.cpp [PDB][NativeSession] Clean up some things in NativeSession. 2020-07-21 16:54:52 -07:00
NativeRawSymbol.cpp
NativeSession.cpp [llvm-symbolizer] Add inline stack traces for Windows. 2020-11-17 13:19:13 -08:00
NativeSourceFile.cpp fix typos to cycle bots 2020-12-12 20:19:33 -05:00
NativeSymbolEnumerator.cpp
NativeTypeArray.cpp
NativeTypeBuiltin.cpp
NativeTypeEnum.cpp
NativeTypeFunctionSig.cpp
NativeTypePointer.cpp
NativeTypeTypedef.cpp
NativeTypeUDT.cpp fix typos to cycle bots 2020-12-12 20:19:33 -05:00
NativeTypeVTShape.cpp
PDBFile.cpp
PDBFileBuilder.cpp FileOutputBuffer.h - remove unused includes. NFC. 2020-05-28 14:38:12 +01:00
PDBStringTable.cpp
PDBStringTableBuilder.cpp
PublicsStream.cpp
RawError.cpp
SymbolCache.cpp [CodeGen, DebugInfo] Use llvm::find_if (NFC) 2021-01-10 09:24:53 -08:00
SymbolStream.cpp
TpiHashing.cpp
TpiStream.cpp
TpiStreamBuilder.cpp [DebugInfo] Use llvm::append_range (NFC) 2021-01-04 11:42:45 -08:00