-
Notifications
You must be signed in to change notification settings - Fork 37
fix: [zip] improve ARM platform plugin selection for large files #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR refactors the ARM (aarch64) plugin selection logic by replacing a simple max-file-size proportion check with explicit size-based thresholds to ensure large files use libarchive, while keeping the original proportion-based check as a fallback for backward compatibility. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @LiHua000 - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/source/mainwindow.cpp:1048` </location>
<code_context>
+ bUseLibarchive = true;
+ }
+ // 大文件占比超过60%使用libarchive
+ else {
+ double maxFileSizeProportion = static_cast<double>(maxFileSize_) / static_cast<double>(m_stCompressParameter.qSize);
+ bUseLibarchive = maxFileSizeProportion > 0.6;
+ }
</code_context>
<issue_to_address>
Potential division by zero if qSize is zero.
Add a check to prevent division when qSize is zero to avoid undefined behavior.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| #ifdef __aarch64__ // 华为arm平台 zip压缩 性能提升. 在多线程场景下使用7z,单线程场景下使用libarchive | ||
| double maxFileSizeProportion = static_cast<double>(maxFileSize_) / static_cast<double>(m_stCompressParameter.qSize); | ||
| bUseLibarchive = maxFileSizeProportion > 0.6; | ||
| // 最大文件超过50MB使用libarchive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Potential division by zero if qSize is zero.
Add a check to prevent division when qSize is zero to avoid undefined behavior.
- 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
eef7b97 to
feac245
Compare
deepin pr auto review代码审查意见:
修改后的代码示例: void MainWindow::slotCompress(const QVariant &val)
{
bool bUseLibarchive = false;
#ifdef __aarch64__
// 最大文件超过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<double>(maxFileSize_) / static_cast<double>(m_stCompressParameter.qSize);
bUseLibarchive = maxFileSizeProportion > 0.6;
}
#else
bUseLibarchive = false;
#endif
}以上修改建议旨在提高代码的可读性、性能和可维护性。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: LiHua000, max-lvs The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/merge |
log: 性能优化
Bug:
Summary by Sourcery
Replace proportion-based logic for selecting libarchive vs 7z on ARM with explicit file size thresholds to fix incorrect plugin selection and optimize performance
Bug Fixes:
Enhancements: