Skip to content

Revert "feat: Introduce pzip high-performance parallel compression for ARM platform"#386

Merged
max-lvs merged 5 commits intolinuxdeepin:release/eaglefrom
LiHua000:revert-372-release/eagle
Apr 14, 2026
Merged

Revert "feat: Introduce pzip high-performance parallel compression for ARM platform"#386
max-lvs merged 5 commits intolinuxdeepin:release/eaglefrom
LiHua000:revert-372-release/eagle

Conversation

@LiHua000
Copy link
Copy Markdown
Contributor

@LiHua000 LiHua000 commented Apr 14, 2026

Reverts #372

Summary by Sourcery

Revert the previously introduced pzip-based high-performance ZIP compression support and restore the prior compression behavior, particularly on ARM platforms.

Enhancements:

  • Restore heuristic-based selection of libarchive vs 7z for ZIP compression on ARM based on file sizes and distribution.

Build:

  • Remove pzip and clipzip third-party plugins and associated CMake configuration and installation rules so the build no longer depends on pzip-specific components.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Apr 14, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR reverts the earlier introduction of the ARM-only pzip high‑performance compression plugin, restoring the previous libarchive/libzip behavior and heuristics, and removes all build, install, and runtime integration of pzip and its clipzip plugin.

Sequence diagram for ARM slotCompress libarchive selection heuristic

sequenceDiagram
actor User
participant MainWindow
participant CompressionEngine
participant LibarchivePlugin
participant LibzipPlugin

User ->> MainWindow: requestCompression(val)
MainWindow ->> MainWindow: slotCompress(val)

MainWindow ->> MainWindow: compute maxFileSize_ and m_stCompressParameter.qSize

alt ARM_aarch64
    MainWindow ->> MainWindow: evaluate conditions
    alt maxFileSize_ > 50MB
        MainWindow ->> MainWindow: bUseLibarchive = true
    else qSize > 200MB
        MainWindow ->> MainWindow: bUseLibarchive = true
    else qSize > 100MB and maxFileSize_ > 10MB
        MainWindow ->> MainWindow: bUseLibarchive = true
    else proportion > 0.6
        MainWindow ->> MainWindow: bUseLibarchive = (maxFileSize_ / qSize) > 0.6
    end
else Non_ARM
    MainWindow ->> MainWindow: bUseLibarchive = false
end

alt bUseLibarchive == true
    MainWindow ->> CompressionEngine: startCompression(LibarchivePlugin)
    CompressionEngine ->> LibarchivePlugin: compressFiles()
else bUseLibarchive == false
    MainWindow ->> CompressionEngine: startCompression(LibzipPlugin)
    CompressionEngine ->> LibzipPlugin: compressFiles()
end
Loading

Class diagram for compression plugin architecture after pzip removal

classDiagram
class MainWindow {
  - bool bUseLibarchive
  - qint64 maxFileSize_
  - CompressParameter m_stCompressParameter
  + void slotCompress(QVariant val)
}

class UiTools {
  + static ReadOnlyArchiveInterface* createInterface(QString fileName, bool bWrite)
}

class Plugin {
  + MetaData metaData()
}

class ReadOnlyArchiveInterface
class LibzipPlugin
class LibminizipPlugin
class LibarchivePlugin
class PzipPlugin_removed
class ClipzipPlugin_removed

MainWindow --> UiTools : uses
MainWindow --> ReadOnlyArchiveInterface : configures_compression
UiTools --> ReadOnlyArchiveInterface : createInterface
UiTools --> Plugin : iterates_offers

Plugin <|-- LibzipPlugin
Plugin <|-- LibminizipPlugin
Plugin <|-- LibarchivePlugin
Plugin <|-- PzipPlugin_removed
Plugin <|-- ClipzipPlugin_removed
Loading

File-Level Changes

Change Details Files
Restore ARM-specific libarchive selection heuristics for ZIP compression in the main window compression flow.
  • Reintroduce size-based thresholds (max file size, total size, combined condition, and size proportion) to decide when to use libarchive on aarch64 instead of the default 7z-based flow for compression.
  • Compute max file size proportion as a double and choose libarchive when large files dominate the archive size.
src/source/mainwindow.cpp
Remove runtime logic that excluded the pzip plugin for ZIP reading operations.
  • Remove the flag that marked pzip as write-only for ZIP files in the archive interface factory.
  • Delete the loop-time check that skipped plugins whose metadata name contained 'pzip' when reading ZIP archives.
src/source/common/uitools.cpp
Remove pzip and clipzip plugin build and installation from the project.
  • Delete ARM-conditional CMake logic that added the pzip and clipzipplugin subdirectories in the 3rdparty CMake configuration.
  • Remove ARM-conditional installation of the clipzipplugin from the top-level CMake configuration.
  • Delete all source, header, JSON metadata, and CMake files for the clipzipplugin.
  • Delete all CMake, command-line tools, headers, and source files for the pzip library and its components.
3rdparty/CMakeLists.txt
CMakeLists.txt
3rdparty/clipzipplugin/CMakeLists.txt
3rdparty/clipzipplugin/clipzipplugin.cpp
3rdparty/clipzipplugin/clipzipplugin.h
3rdparty/clipzipplugin/kerfuffle_clipzip.json
3rdparty/pzip/CMakeLists.txt
3rdparty/pzip/cmd/punzip_main.cpp
3rdparty/pzip/cmd/pzip_main.cpp
3rdparty/pzip/include/pzip/archiver.h
3rdparty/pzip/include/pzip/common.h
3rdparty/pzip/include/pzip/extractor.h
3rdparty/pzip/include/pzip/fast_deflate.h
3rdparty/pzip/include/pzip/file_task.h
3rdparty/pzip/include/pzip/pzip.h
3rdparty/pzip/include/pzip/utils.h
3rdparty/pzip/include/pzip/worker_pool.h
3rdparty/pzip/include/pzip/zip_reader.h
3rdparty/pzip/include/pzip/zip_writer.h
3rdparty/pzip/src/archiver.cpp
3rdparty/pzip/src/extractor.cpp
3rdparty/pzip/src/fast_deflate.cpp
3rdparty/pzip/src/file_task.cpp
3rdparty/pzip/src/utils.cpp
3rdparty/pzip/src/worker_pool.cpp
3rdparty/pzip/src/zip_reader.cpp
3rdparty/pzip/src/zip_writer.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In the ARM-specific compression selection logic, guard the maxFileSize_ / m_stCompressParameter.qSize computation against a possible qSize == 0 to avoid division-by-zero in edge cases (e.g., empty selections).
  • The series of size/threshold checks in slotCompress for __aarch64__ would be easier to maintain and reason about if extracted into a small helper function (e.g., shouldUseLibarchiveForArm(...)) with clearly named parameters and possibly shared between call sites if used elsewhere.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the ARM-specific compression selection logic, guard the `maxFileSize_ / m_stCompressParameter.qSize` computation against a possible `qSize == 0` to avoid division-by-zero in edge cases (e.g., empty selections).
- The series of size/threshold checks in `slotCompress` for `__aarch64__` would be easier to maintain and reason about if extracted into a small helper function (e.g., `shouldUseLibarchiveForArm(...)`) with clearly named parameters and possibly shared between call sites if used elsewhere.

## Individual Comments

### Comment 1
<location path="src/source/mainwindow.cpp" line_range="1093-1094" />
<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>
**issue (bug_risk):** Guard against potential division by zero when computing maxFileSizeProportion.

If `m_stCompressParameter.qSize` can be 0 (e.g., empty selection or placeholder jobs), this will divide by zero. Consider guarding against `qSize == 0` (e.g., early-return or skipping this branch) before computing `maxFileSizeProportion`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +1093 to +1094
else {
double maxFileSizeProportion = static_cast<double>(maxFileSize_) / static_cast<double>(m_stCompressParameter.qSize);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Guard against potential division by zero when computing maxFileSizeProportion.

If m_stCompressParameter.qSize can be 0 (e.g., empty selection or placeholder jobs), this will divide by zero. Consider guarding against qSize == 0 (e.g., early-return or skipping this branch) before computing maxFileSizeProportion.

@deepin-ci-robot
Copy link
Copy Markdown

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@LiHua000
Copy link
Copy Markdown
Contributor Author

/merge

@max-lvs max-lvs merged commit 8bfe0be into linuxdeepin:release/eagle Apr 14, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants