extension-profiling
Compare browser extension performance between branches using WDYR, React DevTools Profiler, and E2E benchmarks with statistical rigor.
- License 许可
- MIT
- 所属仓库
- MetaMask/skills
- 最近更新
- 2026-11-14
- Stars
- ★ 25
- Forks
- 11
01 前言 Front Matter
- name
- extension-profiling
- maturity
- experimental
- description
- Compare browser extension performance between branches using WDYR, React DevTools Profiler, and E2E benchmarks with statistical rigor.
02 资源文件 4
- 参考文档agents/openai.yaml315 B
- 许可证LICENSE24.3 KB
- 参考文档SOURCE.md360 B
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
Browser Extension Profiling
Methodology for profiling and comparing extension performance across branches or commits.
When To Use
- Validating that a refactor reduces unnecessary re-renders (needs before/after comparison)
- Establishing baseline metrics for a performance initiative
- Investigating a reported UI slowdown in the extension
Do Not Use When
- Single-run comparisons — statistical significance requires ≥10 runs per scenario
- The change touches only non-render paths (background scripts, network with no UI impact)
- Target behavior is server-side latency, not UI rendering
Workflow
-
Build both branches on the same machine and Chrome version:
yarn build:testfor the E2E benchmarks, and a development build (yarn startoryarn build:test:dev) for the React DevTools Profiler. For a PR, build the PR's merge-base as the baseline, not main's tip. The merge-base is the build the PR actually changed. -
WDYR profiling (unnecessary re-render counts)
ENABLE_WHY_DID_YOU_RENDER=true yarn startFlags to watch:
different objects that are equal by value→ object recreationdifferent functions with the same name→ callback recreationprops object itself changed but values equal→ parent cascade
-
React DevTools Profiler for flame graphs and commit timings, on a development build.
yarn build:testpasses--mode production, which setsNODE_ENV=production, and React's production build records no profiling data.yarn devtools:react -
E2E benchmarks for scenario durations
yarn test:e2e:benchmark -
Collect ≥10 runs per scenario. Discard top/bottom 10%. Report mean, median, stddev, p75, p95.
-
Effect size: report the difference in the metric's own units alongside Cohen's d. Cohen's d is the difference divided by the benchmark's own spread, so the difference worth acting on comes from product impact, fixed before the runs.
Common Pitfalls
| Mistake | Correct Approach |
|---|---|
| Running branches on different machines or Chrome versions | Same machine, same Chrome, no other apps running |
| Pooling all runs including noisy late-session ones | Fix the primary analysis, and any rule for dropping a round, before the runs. Report per-round stats as sensitivity, with explicit round attribution |
| Reporting absolute re-render counts without scenario context | Normalize per-action; cascade fixes show multiplied impact at root |
| Skipping cache and state reset between runs | Clear browser cache, reset extension state for each run |
Pre-Profiling Checklist
- [ ] Both branches built with
yarn build:test(benchmarks) and a development build (React DevTools Profiler) - [ ] Same machine, same Chrome version
- [ ] No other tabs or applications running
- [ ] WDYR enabled:
ENABLE_WHY_DID_YOU_RENDER=true - [ ] Cache and extension state cleared between runs
- [ ] Wallet state sized for the scenario:
yarn start:with-staterunsyarn startwith a generated fixture wallet (30 accounts by default). A null on an empty wallet is a fact about the fixture, not the code
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
x402-payments
Build x402 payment flows using MetaMask Smart Accounts Kit, machine to machine payments over HTTP with ERC-7710 delegations and ERC-7715 Advanced Permissions
smart-accounts-kit
Build dApps with MetaMask Smart Accounts Kit — ERC-4337 smart accounts, delegations, and Advanced Permissions (ERC-7715)
oh-my-opencode
Multi-agent orchestration plugin for OpenCode. Use when the user wants to install, configure, or operate oh-my-opencode — including agent delegation, ultrawork mode, Prometheus planning, background tasks, category-based task routing, model resolution, tmux integration, or any oh-my-opencode feature. Covers installation, configuration, all agents (Sisyphus, Oracle, Librarian, Explore, Atlas, Prometheus, Metis, Momus), all categories, slash commands, hooks, skills, MCPs, and troubleshooting.
gator-cli
Use when you need to operate the @metamask/gator-cli to initialize profiles, upgrade EOA to EIP-7702, grant, redeem, and revoke ERC-7710 delegations, or inspect balances and delegations. Covers commands, required flags, grant scopes, redeem action types, configuration locations, and common usage flows.
ui-development
UI component development standards for MetaMask clients: the strict design-system-first component hierarchy, availability checks before building custom components, styling with design tokens, and required imports. Use when building, restyling, or reviewing any UI component, or when choosing between a design-system, component-library, or custom component.