From feac245c017df8c5ed26efdf0498a5e415f6f9a3 Mon Sep 17 00:00:00 2001 From: ZhangTingan Date: Tue, 5 Aug 2025 14:11:12 +0800 Subject: [PATCH] fix: [zip] improve ARM platform plugin selection for large files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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: https://pms.uniontech.com/bug-view-328359.html --- src/source/mainwindow.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/source/mainwindow.cpp b/src/source/mainwindow.cpp index d7f0e81b..93b1353f 100644 --- a/src/source/mainwindow.cpp +++ b/src/source/mainwindow.cpp @@ -1032,8 +1032,23 @@ void MainWindow::slotCompress(const QVariant &val) bool bUseLibarchive = false; #ifdef __aarch64__ // 华为arm平台 zip压缩 性能提升. 在多线程场景下使用7z,单线程场景下使用libarchive - double maxFileSizeProportion = static_cast(maxFileSize_) / static_cast(m_stCompressParameter.qSize); - bUseLibarchive = maxFileSizeProportion > 0.6; + // 最大文件超过50MB使用libarchive + if (maxFileSize_ > 50 * 1024 * 1024) { + bUseLibarchive = true; + } + // 总大小超过200MB使用libarchive + else if (m_stCompressParameter.qSize > 200 * 1024 * 1024) { + bUseLibarchive = true; + } + // 总大小超过100MB且最大文件超过10MB使用libarchive(处理均匀分布的大文件) + else if (m_stCompressParameter.qSize > 100 * 1024 * 1024 && maxFileSize_ > 10 * 1024 * 1024) { + bUseLibarchive = true; + } + // 大文件占比超过60%使用libarchive + else { + double maxFileSizeProportion = static_cast(maxFileSize_) / static_cast(m_stCompressParameter.qSize); + bUseLibarchive = maxFileSizeProportion > 0.6; + } #else bUseLibarchive = false; #endif