aboutsummaryrefslogtreecommitdiff
path: root/lld/ELF/SyntheticSections.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2021-12-17 23:30:42 -0800
committerFangrui Song <i@maskray.me>2021-12-17 23:30:42 -0800
commit3aae04c744b03eb3eec7376f9d34fa3e42f8d108 (patch)
tree9d34b896e751d52217e27a841b193b558cc434b2 /lld/ELF/SyntheticSections.cpp
parent4e310d89f22303873c952a9ca5ca91c921407336 (diff)
downloadllvm-3aae04c744b03eb3eec7376f9d34fa3e42f8d108.zip
llvm-3aae04c744b03eb3eec7376f9d34fa3e42f8d108.tar.gz
llvm-3aae04c744b03eb3eec7376f9d34fa3e42f8d108.tar.bz2
[ELF] Parallelize MergeNoTailSection::writeTo
With this patch, writing .debug_str is significantly for a program with 1.5G .debug_str: * .debug_info 1.22s * .debug_str 2.57s decreases to 0.66
Diffstat (limited to 'lld/ELF/SyntheticSections.cpp')
-rw-r--r--lld/ELF/SyntheticSections.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 4e4c4c0..884798e 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -3256,8 +3256,8 @@ void MergeTailSection::finalizeContents() {
}
void MergeNoTailSection::writeTo(uint8_t *buf) {
- for (size_t i = 0; i < numShards; ++i)
- shards[i].write(buf + shardOffsets[i]);
+ parallelForEachN(0, numShards,
+ [&](size_t i) { shards[i].write(buf + shardOffsets[i]); });
}
// This function is very hot (i.e. it can take several seconds to finish)