performance-regression-testing
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePerformance Regression Testing
性能回归测试
Any change to the render pipeline must prove it does not increase capture time. The primary guard is , which measures end-to-end in multiple scenarios.
serializeTimelineDirect.perf.browsertest.tscaptureTimelineToDataUri任何对渲染管道的修改都必须证明不会增加捕获时间。主要的保障手段是,它会在多种场景下端到端测量的性能。
serializeTimelineDirect.perf.browsertest.tscaptureTimelineToDataUriQuick Workflow
快速工作流程
bash
undefinedbash
undefinedBefore making changes — record baseline numbers from the terminal output
进行修改前 —— 从终端输出记录基准数值
cd elements
./scripts/browsertest packages/elements/src/preview/rendering/serializeTimelineDirect.perf.browsertest.ts
cd elements
./scripts/browsertest packages/elements/src/preview/rendering/serializeTimelineDirect.perf.browsertest.ts
Make your changes, then re-run
完成修改后,重新运行
./scripts/browsertest packages/elements/src/preview/rendering/serializeTimelineDirect.perf.browsertest.ts
The test prints `p50`, `p95`, `p99` for each scenario. A fix is acceptable if p95 does not regress. Copy the before/after numbers into the PR description as evidence../scripts/browsertest packages/elements/src/preview/rendering/serializeTimelineDirect.perf.browsertest.ts
测试会打印每个场景的`p50`、`p95`、`p99`数值。只要p95没有退化,修改就是可接受的。将修改前后的数值复制到PR描述中作为证据。What Each Scenario Tests
各场景测试内容
See for the current scenario list. Typically: simple HTML, text-heavy content, canvas elements, mixed composition at 1920×1080.
serializeTimelineDirect.perf.browsertest.ts当前的场景列表请查看。通常包括:简单HTML、文本密集型内容、canvas元素、1920×1080分辨率下的混合合成内容。
serializeTimelineDirect.perf.browsertest.tsInterpreting the Output
输出结果解读
Each scenario reports:
- /
p50/p95timing in ms forp99(serialization only) andserializeMs(serialize + image load)totalMs - as a proxy for output size
dataUriLength
Focus on . Small additions to add one lookup per element per serialization — negligible unless the composition has thousands of elements.
p95 serializeMsSERIALIZED_STYLE_PROPERTIESgetComputedStyle每个场景会报告:
- (仅序列化)和
serializeMs(序列化 + 图片加载)的totalMs/p50/p95耗时(单位:毫秒)p99 - ,作为输出大小的代理指标
dataUriLength
重点关注。向中添加少量属性会导致每次序列化时每个元素多一次查询——除非合成内容包含数千个元素,否则影响可以忽略不计。
p95 serializeMsSERIALIZED_STYLE_PROPERTIESgetComputedStyleRelating Perf to Parity Fixes
性能测试与兼容性修复的关联
When fixing a CSS property gap in :
SERIALIZED_STYLE_PROPERTIES- Run perf before the fix, note p95
- Add the property, re-run perf
- If p95 stays within noise (±5%), the fix is safe
- If p95 climbs, profile with the skill to identify the bottleneck
profile-tests
当修复中的CSS属性缺口时:
SERIALIZED_STYLE_PROPERTIES- 修复前运行性能测试,记录p95数值
- 添加属性后,重新运行性能测试
- 如果p95在误差范围内(±5%),则修复是安全的
- 如果p95上升,使用工具分析以确定瓶颈
profile-tests
Broader Perf Tests
更全面的性能测试
For frame-by-frame scrub and full pipeline timing, see:
canvas-scrub-performance.browsertest.tsrenderPipeline.perf.browsertest.ts
These are slower to run (long iteration counts). Use them when the change is structural (e.g., changing how canvases are encoded or how the DOM is walked), not for individual property additions.
如需逐帧scrub和全管道耗时测试,请查看:
canvas-scrub-performance.browsertest.tsrenderPipeline.perf.browsertest.ts
这些测试运行速度较慢(迭代次数多)。当修改涉及结构性变化时(例如更改画布编码方式或DOM遍历方式)使用它们,而不是针对单个属性的添加。
When to Use This Skill
何时使用此方法
- Before and after any change to
serializeTimelineDirect.ts - Before merging a parity fix branch
- When a parity test starts taking noticeably longer than before
- 修改前后
serializeTimelineDirect.ts - 合并兼容性修复分支前
- 当兼容性测试耗时明显变长时