[PATCH] D115416: [lld-macho] Prevent writing map files on the critical path
Vy Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 14 06:24:30 PST 2021
oontvoo added inline comments.
================
Comment at: lld/MachO/Writer.cpp:1103-1114
+ ThreadPool writeUuidThreadPool;
+
ArrayRef<uint8_t> data{buffer->getBufferStart(), buffer->getBufferEnd()};
unsigned chunkCount = parallel::strategy.compute_thread_count() * 10;
// Round-up integer division
size_t chunkSize = (data.size() + chunkCount - 1) / chunkCount;
std::vector<ArrayRef<uint8_t>> chunks = split(data, chunkSize);
----------------
thevinster wrote:
> int3 wrote:
> > thevinster wrote:
> > > oontvoo wrote:
> > > > why is this change needed?
> > > >
> > > This commit is meant as a way to show the different ways we could be using `ThreadPool`. It's more of an RFC (See https://reviews.llvm.org/D115416#3190992). As far as why we want to change it (per @int3's suggestion), we want to change all our uses of `parallelForEach` in favor of `ThreadPool` so we can control the total number of threads.
> > we should be reusing the `writerThreadPool` here instead of creating a `writeUuidThreadPool`... each ThreadPool maintains its own counter of the number of threads spawned
> Okay, so it sounds like we want to go for Option 2 then?
> we should be reusing the `writerThreadPool` here instead of creating a `writeUuidThreadPool`... each ThreadPool maintains its own counter of the number of threads spawned
Yeah +1 to this.
Maybe my question was too terse - I was asking why you needed to switch paranllelForEachN for a more manual approach but NOT used the `writerThreadPool`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115416/new/
https://reviews.llvm.org/D115416
More information about the llvm-commits
mailing list