aboutsummaryrefslogtreecommitdiff
path: root/CPP/7zip/UI/GUI/CompressDialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CPP/7zip/UI/GUI/CompressDialog.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/CPP/7zip/UI/GUI/CompressDialog.cpp b/CPP/7zip/UI/GUI/CompressDialog.cpp
index 58f863e..85d7186 100644
--- a/CPP/7zip/UI/GUI/CompressDialog.cpp
+++ b/CPP/7zip/UI/GUI/CompressDialog.cpp
@@ -2600,11 +2600,17 @@ void CCompressDialog::SetNumThreads2()
2600 UInt32 numAlgoThreadsMax = numHardwareThreads * 2; 2600 UInt32 numAlgoThreadsMax = numHardwareThreads * 2;
2601 const int methodID = GetMethodID(); 2601 const int methodID = GetMethodID();
2602 2602
2603 switch (methodID) 2603 const bool isZip = IsZipFormat();
2604 if (isZip)
2605 numAlgoThreadsMax =
2606 8 << (sizeof(size_t) / 2); // 32 threads for 32-bit : 128 threads for 64-bit
2607 else if (IsXzFormat())
2608 numAlgoThreadsMax = 256 * 2;
2609 else switch (methodID)
2604 { 2610 {
2605 case kLZMA: numAlgoThreadsMax = 2; break; 2611 case kLZMA: numAlgoThreadsMax = 2; break;
2606 case kLZMA2: numAlgoThreadsMax = 256; break; 2612 case kLZMA2: numAlgoThreadsMax = 256; break;
2607 case kBZip2: numAlgoThreadsMax = 32; break; 2613 case kBZip2: numAlgoThreadsMax = 64; break;
2608 // case kZSTD: numAlgoThreadsMax = num_ZSTD_threads_MAX; break; 2614 // case kZSTD: numAlgoThreadsMax = num_ZSTD_threads_MAX; break;
2609 case kCopy: 2615 case kCopy:
2610 case kPPMd: 2616 case kPPMd:
@@ -2613,17 +2619,6 @@ void CCompressDialog::SetNumThreads2()
2613 case kPPMdZip: 2619 case kPPMdZip:
2614 numAlgoThreadsMax = 1; 2620 numAlgoThreadsMax = 1;
2615 } 2621 }
2616 const bool isZip = IsZipFormat();
2617 if (isZip)
2618 {
2619 numAlgoThreadsMax =
2620 #ifdef _WIN32
2621 64; // _WIN32 supports only 64 threads in one group. So no need for more threads here
2622 #else
2623 128;
2624 #endif
2625 }
2626
2627 UInt32 autoThreads = numHardwareThreads; 2622 UInt32 autoThreads = numHardwareThreads;
2628 if (autoThreads > numAlgoThreadsMax) 2623 if (autoThreads > numAlgoThreadsMax)
2629 autoThreads = numAlgoThreadsMax; 2624 autoThreads = numAlgoThreadsMax;
@@ -3008,7 +3003,7 @@ UInt64 CCompressDialog::GetMemoryUsage_Threads_Dict_DecompMem(UInt32 numThreads,
3008 else 3003 else
3009 { 3004 {
3010 size += numBlockThreads * (size1 + chunkSize); 3005 size += numBlockThreads * (size1 + chunkSize);
3011 UInt32 numPackChunks = numBlockThreads + (numBlockThreads / 8) + 1; 3006 const UInt32 numPackChunks = numBlockThreads + (numBlockThreads / 8) + 1;
3012 if (chunkSize < ((UInt32)1 << 26)) numBlockThreads++; 3007 if (chunkSize < ((UInt32)1 << 26)) numBlockThreads++;
3013 if (chunkSize < ((UInt32)1 << 24)) numBlockThreads++; 3008 if (chunkSize < ((UInt32)1 << 24)) numBlockThreads++;
3014 if (chunkSize < ((UInt32)1 << 22)) numBlockThreads++; 3009 if (chunkSize < ((UInt32)1 << 22)) numBlockThreads++;