Skip to content

Commit eef7b97

Browse files
committed
fix: [zip] improve ARM platform plugin selection for large files
- Replace proportion-based logic with size-based thresholds - Fix uniform large files incorrectly using 7z instead of libarchive - Add size thresholds: max file > 50MB, total > 200MB, or (total > 100MB && max > 10MB) - Maintain backward compatibility with original proportion logic log: 性能优化 Bug:
1 parent 40d050c commit eef7b97

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/source/mainwindow.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,8 +1032,23 @@ void MainWindow::slotCompress(const QVariant &val)
10321032

10331033
bool bUseLibarchive = false;
10341034
#ifdef __aarch64__ // 华为arm平台 zip压缩 性能提升. 在多线程场景下使用7z,单线程场景下使用libarchive
1035-
double maxFileSizeProportion = static_cast<double>(maxFileSize_) / static_cast<double>(m_stCompressParameter.qSize);
1036-
bUseLibarchive = maxFileSizeProportion > 0.6;
1035+
// 最大文件超过50MB使用libarchive
1036+
if (maxFileSize_ > 50 * 1024 * 1024) {
1037+
bUseLibarchive = true;
1038+
}
1039+
// 总大小超过200MB使用libarchive
1040+
else if (m_stCompressParameter.qSize > 200 * 1024 * 1024) {
1041+
bUseLibarchive = true;
1042+
}
1043+
// 总大小超过100MB且最大文件超过10MB使用libarchive(处理均匀分布的大文件)
1044+
else if (m_stCompressParameter.qSize > 100 * 1024 * 1024 && maxFileSize_ > 10 * 1024 * 1024) {
1045+
bUseLibarchive = true;
1046+
}
1047+
// 大文件占比超过60%使用libarchive
1048+
else {
1049+
double maxFileSizeProportion = static_cast<double>(maxFileSize_) / static_cast<double>(m_stCompressParameter.qSize);
1050+
bUseLibarchive = maxFileSizeProportion > 0.6;
1051+
}
10371052
#else
10381053
bUseLibarchive = false;
10391054
#endif

0 commit comments

Comments
 (0)