mirror of
https://github.com/facebook/zstd.git
synced 2025-07-14 11:14:18 +02:00
[pzstd] Spawn less threads in tests
MinGW thread performance degrades significantly when there are a lot of threads, so limit the number of threads spawned to ~10.
This commit is contained in:
@ -20,12 +20,12 @@ TEST(ThreadPool, Ordering) {
|
||||
|
||||
{
|
||||
ThreadPool executor(1);
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
executor.add([ &results, i ] { results.push_back(i); });
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
EXPECT_EQ(i, results[i]);
|
||||
}
|
||||
}
|
||||
@ -35,7 +35,7 @@ TEST(ThreadPool, AllJobsFinished) {
|
||||
std::atomic<bool> start{false};
|
||||
{
|
||||
ThreadPool executor(5);
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
executor.add([ &numFinished, &start ] {
|
||||
while (!start.load()) {
|
||||
// spin
|
||||
@ -45,7 +45,7 @@ TEST(ThreadPool, AllJobsFinished) {
|
||||
}
|
||||
start.store(true);
|
||||
}
|
||||
EXPECT_EQ(1000, numFinished.load());
|
||||
EXPECT_EQ(10, numFinished.load());
|
||||
}
|
||||
|
||||
TEST(ThreadPool, AddJobWhileJoining) {
|
||||
|
Reference in New Issue
Block a user