Parallelize .gdb_index string table writes.
authorRui Ueyama <ruiu@google.com>
Tue, 25 Sep 2018 14:34:56 +0000 (14:34 +0000)
committerRui Ueyama <ruiu@google.com>
Tue, 25 Sep 2018 14:34:56 +0000 (14:34 +0000)
When we are creating a large .gdb_index, this change makes a difference.

llvm-svn: 342978

lld/ELF/SyntheticSections.cpp

index e4b1b0c..a12a506 100644 (file)
@@ -2576,8 +2576,9 @@ void GdbIndexSection::writeTo(uint8_t *Buf) {
 
   // Write the string pool.
   Hdr->ConstantPoolOff = Buf - Start;
-  for (GdbSymbol &Sym : Symbols)
+  parallelForEach(Symbols, [&](GdbSymbol &Sym) {
     memcpy(Buf + Sym.NameOff, Sym.Name.data(), Sym.Name.size());
+  });
 
   // Write the CU vectors.
   for (GdbSymbol &Sym : Symbols) {