compare-bundles
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCompare Bundles
应用包对比
Quick Start
快速开始
You'll typically receive two bundle identifiers. Follow these steps:
- Run to find bundles on each branch.
tuist bundle list --json - Run for both base and head bundles.
tuist bundle show <bundle-id> --json - Compare artifact trees with .
tuist bundle artifact list <bundle-id> --json - Compare install size, download size, and other metadata.
- Summarize size changes with actionable recommendations.
你通常会拿到两个bundle标识符,按照以下步骤操作:
- 运行 查找每个分支上的应用包。
tuist bundle list --json - 分别对基准包和对比包执行 命令。
tuist bundle show <bundle-id> --json - 执行 对比产物树。
tuist bundle artifact list <bundle-id> --json - 对比安装体积、下载体积和其他元数据。
- 总结体积变化,给出可落地的优化建议。
Step 1: Resolve Bundles
步骤1:解析应用包
If base/head are bundle IDs or dashboard URLs
如果基准/对比包是bundle ID或仪表盘URL
Fetch each directly:
bash
tuist bundle show <base-id> --json
tuist bundle show <head-id> --json直接拉取信息即可:
bash
tuist bundle show <base-id> --json
tuist bundle show <head-id> --jsonIf base/head are branch names
如果基准/对比包是分支名称
List recent bundles on each branch and pick the latest:
bash
tuist bundle list --git-branch <base-branch> --json
tuist bundle list --git-branch <head-branch> --jsonThen fetch full details with .
tuist bundle show <id> --json列出每个分支上的最近应用包,选择最新版本:
bash
tuist bundle list --git-branch <base-branch> --json
tuist bundle list --git-branch <head-branch> --json然后执行 拉取完整详情。
tuist bundle show <id> --jsonDefaults
默认规则
- If no base is provided, use the project's default branch (usually ).
main - If no head is provided, detect the current git branch.
- 若未提供基准包,使用项目的默认分支(通常是)。
main - 若未提供对比包,自动检测当前git分支。
Step 2: Compare Artifact Trees
步骤2:对比产物树
After fetching both bundles with , compare the individual artifacts:
tuist bundle show <id> --jsonbash
tuist bundle artifact list <base-id> --json
tuist bundle artifact list <head-id> --jsonMatch artifacts by name across both bundles. Look for:
- New artifacts added in the head bundle (potential size contributors)
- Removed artifacts (explain size decreases)
- Size changes in existing artifacts
通过拉取两个应用包的信息后,对比单个产物:
tuist bundle show <id> --jsonbash
tuist bundle artifact list <base-id> --json
tuist bundle artifact list <head-id> --json按名称匹配两个应用包的产物,重点关注:
- 对比包中新增的产物(可能是体积增长的原因)
- 移除的产物(可解释体积减少的原因)
- 现有产物的体积变化
Step 3: Compare Top-Level Metrics
步骤3:对比核心指标
After fetching both bundles, compare:
| Metric | What to check |
|---|---|
| Flag if head is >5% larger |
| Flag if head is >5% larger |
| Note version changes |
| Note platform changes |
| Should match between base and head |
Compute deltas:
- Install size delta:
head_install_size - base_install_size - Download size delta:
head_download_size - base_download_size - Percentage change:
delta / base_size * 100
拉取两个应用包的信息后,对比以下内容:
| 指标 | 检查要点 |
|---|---|
| 如果对比包体积超出基准包5%则标记 |
| 如果对比包体积超出基准包5%则标记 |
| 记录版本变化 |
| 记录支持平台的变化 |
| 基准包和对比包的该字段应该一致 |
计算差值:
- 安装体积差值:
head_install_size - base_install_size - 下载体积差值:
head_download_size - base_download_size - 变化百分比:
delta / base_size * 100
Step 4: Analyze Size Changes
步骤4:分析体积变化
If size increased significantly (>5%):
- Check if changed, which might explain expected size growth.
version - Check if changed (adding a platform increases size).
supported_platforms - Look at the field in the bundle details for individual artifact sizes.
artifacts
Common causes of size increases:
- New frameworks or libraries added
- Asset catalogs grew (new images, videos)
- Unoptimized resources (large PNGs instead of compressed formats)
- Debug symbols included in release builds
- New localizations added
Common causes of size decreases:
- Removed unused frameworks
- Optimized assets
- Tree shaking or dead code elimination improvements
- Moved functionality to on-demand resources
如果体积增长明显(超过5%):
- 检查是否变更,这可能是预期的体积增长原因。
version - 检查是否变更(新增支持平台会增加体积)。
supported_platforms - 查看应用包详情中的字段,了解单个产物的体积。
artifacts
体积增长的常见原因:
- 新增了框架或依赖库
- 资源包体积增大(新增图片、视频)
- 资源未优化(使用未压缩的大PNG而非压缩格式)
- Release构建中包含了调试符号
- 新增了多语言支持
体积减少的常见原因:
- 移除了未使用的框架
- 资源优化
- Tree shaking或dead code elimination优化
- 将功能迁移到按需加载资源
Summary Format
总结格式
Produce a summary with:
- Overall verdict: Size increased, decreased, or stable.
- Install size: Absolute and percentage change.
- Download size: Absolute and percentage change.
- Version: Note if version changed.
- Platforms: Note any platform changes.
- Recommendations: Actionable next steps for size regressions.
Example:
Bundle Comparison: base (v2.1.0 on main) vs head (v2.2.0 on feature-x)
Install Size: 45.2 MB -> 52.8 MB (+16.8%) -- REGRESSION
Download Size: 28.1 MB -> 32.4 MB (+15.3%) -- REGRESSION
Version: 2.1.0 -> 2.2.0
Platforms: iOS, macOS (unchanged)
The install size increased by 7.6 MB. This is a significant increase
that may affect user download and storage experience.
Recommendations:
- Review new frameworks or assets added in this version
- Check for uncompressed resources or oversized image assets
- Consider using asset compression or on-demand resources
- Run `xcrun bitcode_strip` analysis to check for unnecessary bitcode产出的总结需要包含以下内容:
- 整体结论:体积增长、减少或保持稳定。
- 安装体积:绝对值和百分比变化。
- 下载体积:绝对值和百分比变化。
- 版本:记录版本是否变更。
- 支持平台:记录平台的任何变化。
- 优化建议:针对体积回归的可落地后续步骤。
示例:
Bundle Comparison: base (v2.1.0 on main) vs head (v2.2.0 on feature-x)
Install Size: 45.2 MB -> 52.8 MB (+16.8%) -- REGRESSION
Download Size: 28.1 MB -> 32.4 MB (+15.3%) -- REGRESSION
Version: 2.1.0 -> 2.2.0
Platforms: iOS, macOS (unchanged)
The install size increased by 7.6 MB. This is a significant increase
that may affect user download and storage experience.
Recommendations:
- Review new frameworks or assets added in this version
- Check for uncompressed resources or oversized image assets
- Consider using asset compression or on-demand resources
- Run `xcrun bitcode_strip` analysis to check for unnecessary bitcodeDone Checklist
完成清单
- Resolved both base and head bundles
- Compared artifact trees using
tuist bundle artifact list - Compared install and download sizes
- Analyzed root causes of size changes
- Provided actionable recommendations
- 已解析基准包和对比包
- 已使用对比产物树
tuist bundle artifact list - 已对比安装体积和下载体积
- 已分析体积变化的根本原因
- 已给出可落地的优化建议