agents/skills/chrome-performance-optimizer/SKILL.md
This skill provides an autonomous agent loop that ingests performance profiles (from web pprof links, profile IDs, Sagacity MCP, or Crossbench logs), designs macro-optimizations in Blink or V8, validates correctness locally, tests on Pinpoint hardware bots, and manages CL lifecycles based on statistical confidence.
graph TD
A[1. Ingest Profile: pprof link / ID / Sagacity MCP] --> B[2. Formulate Macro Hypothesis]
B --> C[3. Implement on Dedicated Branch]
C --> D[4. Verify Locally: Tests & Crossbench]
D -->|Fail| C
D -->|Pass| E[5. Upload CL to Gerrit]
E --> F[6. Run Pinpoint on M1: pp c -c m1 -t sp3 -r 150]
F --> G[7. Poll & Evaluate Results: pp s]
G -->|Stat-Significant Improvement| H[8. Propose CL & Update Benchmark Report]
G -->|No Improvement or Regressed| I[9. Abandon CL: git cl abandon]
H --> A
I --> A
You can provide one or multiple profile sources:
pprof/?id=XYZ or
https://pprof.corp.google.com/?id=XYZid:XYZ or raw ID XYZfetch_uploaded_profile(profileKey="XYZ")v8.logTop Cumulative Call Stacks (identify caller subtrees):
vpython3 agents/skills/chrome-performance-optimizer/scripts/analyze_profile.py "pprof/?id=XYZ" --mode=cum --nodecount=30
Top Flat Functions (identify hot leaf loops):
vpython3 agents/skills/chrome-performance-optimizer/scripts/analyze_profile.py "pprof/?id=XYZ" --mode=flat --nodecount=30
Inspect Callers & Callees for a Specific Symbol:
vpython3 agents/skills/chrome-performance-optimizer/scripts/analyze_profile.py "pprof/?id=XYZ" --mode=peek --symbol="*HasOwnProperty*"
Compare Two Profiles (Diff Mode):
vpython3 agents/skills/chrome-performance-optimizer/scripts/analyze_profile.py "pprof/?id=EXP_ID" --base="pprof/?id=BASE_ID" --mode=cum
Classify the Bottleneck Pattern: Consult Macro-Optimization Patterns for proven solutions:
SkPathBuilder allocations,
disconnected strokes.# For Blink / Chromium root changes:
git checkout -b perf_<feature_name> origin/main
# For V8 engine submodule changes:
git -C v8 checkout -b perf_<feature_name> origin/main
Always verify correctness before uploading to avoid wasting Pinpoint bot resources:
Unit Tests:
# For Blink changes:
autoninja -C out/release blink_unittests
./out/release/blink_unittests --gtest_filter="<RelevantTestPattern>"
# For V8 changes:
autoninja -C out/release v8:d8
./out/release/d8 v8/test/mjsunit/mjsunit.js <path_to_test.js>
Web Tests (Layout / Rendering / Canvas):
autoninja -C out/release content_shell
./third_party/blink/tools/run_web_tests.py -t release <path_to_web_test.html>
Crossbench Benchmark Smoke Test:
autoninja -C out/release chrome chromedriver
./third_party/crossbench/cb.py speedometer_3.1 --browser=out/release/chrome --driver-path=out/release/chromedriver --stories=<TargetStory> --headless
git commit -m "[<Subsystem>] <Title>
<Detailed architectural explanation and expected benchmark impact>
TAG=agy
CONV=<conversation_id>"
git cl upload -m "Performance optimization for Speedometer 3" --cq-dry-run
git cl issue
Launch a 150-iteration try job on Apple Silicon M1 bots:
pp c -c m1 -t sp3 -r 150
-c m1: Target M1 hardware bot.-t sp3: Target Speedometer 3 benchmark template.-r 150: 150 repetitions per variant for high statistical confidence.Inspect results once the job completes:
vpython3 agents/skills/chrome-performance-optimizer/scripts/pinpoint_evaluator.py --action evaluate --job-id <JOB_ID>
Or directly view the comparison table:
pp s <JOB_ID>
Decision Rules:
git cl upload -m "Add Pinpoint M1 benchmark results (+X.X% improvement)"
git cl abandon -m "Pinpoint try job (150 iterations on M1) showed no statistically significant speedup."
origin/main and iterate to the next candidate
profile/bottleneck.