COFF: Parallelize Writer::writeSections().

Self-hosting took 801 ms on my machine. Of which this function took
69 ms. Now it takes 37 ms. That is about 4% overall performance
improvement.

llvm-svn: 248052
This commit is contained in:
Rui Ueyama 2015-09-18 22:07:10 +00:00
parent 54e9d238b6
commit e0e0796d83
1 changed files with 3 additions and 2 deletions

View File

@ -14,6 +14,7 @@
#include "SymbolTable.h"
#include "Symbols.h"
#include "Writer.h"
#include "lld/Core/Parallel.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
@ -708,8 +709,8 @@ void Writer::writeSections() {
// ADD instructions).
if (Sec->getPermissions() & IMAGE_SCN_CNT_CODE)
memset(SecBuf, 0xCC, Sec->getRawSize());
for (Chunk *C : Sec->getChunks())
C->writeTo(SecBuf);
parallel_for_each(Sec->getChunks().begin(), Sec->getChunks().end(),
[&](Chunk *C) { C->writeTo(SecBuf); });
}
}