Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/pack-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ jobs:
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/share/swift
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/share/miniconda
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pack-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/share/swift
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/local/lib/node_modules
Expand Down
130 changes: 130 additions & 0 deletions .github/workflows/pack-perf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: utoopack-perf

on:
push:
branches: [ main, next ]
pull_request:
branches: [ main, next ]
workflow_dispatch:

permissions:
contents: read
pull-requests: write

jobs:
performance:
name: Run Performance Benchmarks
if: (github.event_name == 'push' && !contains(github.event.head_commit.message, '(pm)')) || (github.event_name == 'pull_request' && !contains(github.event.pull_request.title, '(pm)'))
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Init git submodules
run: git submodule update --init --recursive --depth 1

- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf /usr/share/swift
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/share/miniconda
sudo docker image prune --all --force

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2025-10-27
components: rustfmt, clippy

- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: utoopack-perf
cache-directories: |
target/release-local

- name: Install dependencies
run: npm install

- name: Build Bundler
run: |
# Build packages
npm run build --workspace @utoo/pack-shared
npm run build:local --workspace @utoo/pack
npm run build --workspace @utoo/pack-cli

- name: Run Benchmark - with-antd
run: |
mkdir -p .trace
TRACING_CHROME=$PWD/.trace/trace_antd.json npm run build --prefix examples/with-antd
env:
NODE_ENV: production

- name: Analyze Traces
run: |
python3 agents/tools/analyze_trace.py .trace/trace_antd.json .trace/report_antd.md
# Prepare PR comment content
echo "## 📊 Performance Benchmark Report (with-antd)" > .trace/pr_comment.md
cat .trace/report_antd.md >> .trace/pr_comment.md
# Add to Job Summary
cat .trace/pr_comment.md >> $GITHUB_STEP_SUMMARY

- name: Find Current PR
id: findPr
run: |
echo "debug: Event name: ${{ github.event_name }}"
echo "debug: Ref: ${{ github.ref }}"
echo "debug: Ref name: ${{ github.ref_name }}"

PR_NUMBER=""

if [[ "${{ github.event_name }}" == "pull_request" ]]; then
PR_NUMBER="${{ github.event.pull_request.number }}"
echo "debug: Found PR number from event: $PR_NUMBER"
else
# Try to match by branch name
echo "debug: Trying to find PR for branch '${{ github.ref_name }}'..."
PR_NUMBER=$(gh pr list --head "${{ github.ref_name }}" --state open --json number --jq '.[0].number')

# If not found, try to match by commit SHA
if [ -z "$PR_NUMBER" ] || [ "$PR_NUMBER" == "null" ]; then
echo "debug: Branch match failed, trying commit SHA match for ${{ github.sha }}..."
PR_NUMBER=$(gh pr list --search "${{ github.sha }}" --state open --json number --jq '.[0].number')
fi
fi

if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then
echo "debug: Final PR number: $PR_NUMBER"
echo "number=$PR_NUMBER" >> $GITHUB_OUTPUT
else
echo "debug: No PR number found."
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}

- name: Post PR Comment
if: steps.findPr.outputs.number
uses: marocchino/sticky-pull-request-comment@v2
with:
header: utoopack-perf-report
path: .trace/pr_comment.md
number: ${{ steps.findPr.outputs.number }}
recreate: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Traces
uses: actions/upload-artifact@v4
with:
name: utoopack-perf-traces
path: .trace/
retention-days: 7
7 changes: 3 additions & 4 deletions .github/workflows/pack-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ jobs:
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/share/swift
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/share/miniconda
Expand Down Expand Up @@ -198,9 +197,9 @@ jobs:
fi
echo "Publishing with tag: $TAG"

npm version --workspace=@utoo/pack-shared "${VERSION}" --no-git-tag-version &&
npm version --workspace=@utoo/pack "${VERSION}" --no-git-tag-version &&
npm version --workspace=@utoo/pack-cli "${VERSION}" --no-git-tag-version &&
npm version --workspace=@utoo/pack-shared "${VERSION}" --no-git-tag-version --workspaces-update=false &&
npm version --workspace=@utoo/pack "${VERSION}" --no-git-tag-version --workspaces-update=false &&
npm version --workspace=@utoo/pack-cli "${VERSION}" --no-git-tag-version --workspaces-update=false &&
npm pkg set dependencies.@utoo/pack-shared="${VERSION}" --workspace=@utoo/pack &&
npm pkg set dependencies.@utoo/pack="${VERSION}" --workspace=@utoo/pack-cli &&
npm publish --workspace=@utoo/pack-shared --access public --tag "${TAG}" &&
Expand Down
52 changes: 52 additions & 0 deletions agents/reports/utoopack_performance_report_20260126_215953.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 🔬 Utoopack Performance Analysis Report (Re-Verified)

**Report ID**: `utoopack_performance_report_20260126_215953`
**Generated**: 2026-01-26 21:59:53 (Updated: 2026-01-26 23:10:00)
**Trace File**: `.trace/optimized_new.json`
**Protocol**: [Utoopack Performance Analysis Agent Protocol](../utoopack-performance-agent.md)

---

## 📋 Executive Summary

### 📊 Overall Performance Status: **OPTIMIZED**

This report provides a re-verified analysis of the **Extension Priority Reordering** optimization, using a fresh baseline on a stable system state. The results confirm a consistent reduction in resolution-related overhead.

**Key Metrics (Verified Delta)**:
- ⏱️ **Wall Time**: 2,993.5 ms (**-24.3 ms / -0.8%**)
- 🗺️ **Resolution Efficiency**: 46,199 calls (**-3,522 / -7.1%**)
- 📈 **Resolution Time**: 1,524.1 ms (**-80.3 ms / -5.0%**)

### 📊 Performance Comparison (New Baseline)

| Metric | Clean Baseline (0126) | Optimized (Current) | Delta |
|:---|:---:|:---:|:---|
| **Resolving Calls** | 49,721 | **46,199** | **-3,522 (-7.1%)** |
| **Resolution Time** | 1,604.4 ms | **1,524.1 ms** | **-80.3 ms (-5.0%)** |
| **Wall Clock Time** | 3,017.8 ms | **2,993.5 ms** | **-24.3 ms (-0.8%)** |

---

## 🔍 Tier 1: The Runtime Backbone (Priority: P0)

### 💥 A. Critical Path Serialization
- **Status**: 🔴 **CRITICAL**
- **Analysis**: Thread utilization remains low (~42%). This indicates that while we have optimized the *amount* of work (reduced resolving calls), the build speed is still primarily limited by the sequential nature of the resolution pipeline.
- **Action**: Future work should focus on batching resolution requests or using `Vc` joins to parallelize the critical path.

### 🗺️ C. Resolution & Plugin Hotspots
- **Status**: 🟩 **OPTIMIZED**
- **Analysis**: Prioritizing `.js` over `.ts` for `node_modules` successfully avoids unnecessary filesystem probes. The ~7% reduction in resolving calls is a stable performance gain across different dependency states.

---

## 🚨 Recommended Next Steps

1. **[P0-A] Parallelize Resolution Chains**: Shift focus to high-level concurrency in `turbopack-resolve`.
2. **[P1-C] Metadata Batching**: Implement concurrent `read_dir` metadata caching to further reduce I/O latency.

---
*Generated by Utoopack Performance Analysis Agent*
*Timestamp: 20260126_231000*

Loading