diff options
author | Evgenii Stepanov <eugenis@google.com> | 2021-04-12 13:35:32 -0700 |
---|---|---|
committer | Evgenii Stepanov <eugenis@google.com> | 2021-04-14 17:13:15 -0700 |
commit | 51aa61e74bdb394d89217350ddcb0fd04a21e32f (patch) | |
tree | 2d608122f1a6f400fb3c8b7758b48b918ae9bf8d /llvm/tools/llvm-objdump/llvm-objdump.cpp | |
parent | 1035123ac50db21bb2f44f78c040a823d7d064b2 (diff) | |
download | llvm-51aa61e74bdb394d89217350ddcb0fd04a21e32f.zip llvm-51aa61e74bdb394d89217350ddcb0fd04a21e32f.tar.gz llvm-51aa61e74bdb394d89217350ddcb0fd04a21e32f.tar.bz2 |
[hwasan] Fix lock contention on thread creation.
Do not hold the free/live thread list lock longer than necessary.
This change speeds up the following benchmark 10x.
constexpr int kTopThreads = 50;
constexpr int kChildThreads = 20;
constexpr int kChildIterations = 8;
void Thread() {
for (int i = 0; i < kChildIterations; ++i) {
std::vector<std::thread> threads;
for (int i = 0; i < kChildThreads; ++i)
threads.emplace_back([](){});
for (auto& t : threads)
t.join();
}
}
int main() {
std::vector<std::thread> threads;
for (int i = 0; i < kTopThreads; ++i)
threads.emplace_back(Thread);
for (auto& t : threads)
t.join();
}
Differential Revision: https://reviews.llvm.org/D100348
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
0 files changed, 0 insertions, 0 deletions