chart/TEST.md

19 lines
731 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Chart.js ESM Performance Benchmark
## 测试环境
- Playwright (Headless Chromium)
- CPU: Host machine
- Chart.js version: 4.x
## 性能基准 (v1.0.2)
| 指标 | 耗时 (ms) | 备注 |
| :--- | :--- | :--- |
| **首次渲染 (Line Chart)** | 44.50 | 包含 Chart.js 初始化、双图表渲染及组件初始化测试 |
| **数据更新 (Smooth Update)** | < 10.00 | 基于 `chart.update()` 的增量更新 |
## 设计决策
1. **Tree Shaking**: 仅内置常用的控制器Line, Bar, Pie以控制产物体积
2. **实例复用**: 严格遵循 `chart.update()` 路径避免频繁创建 Canvas 渲染上下文
3. **组件化支持**: 通过 `globalThis.Component` 注册实现零打包声明式渲染