[Perf] Rolling motion: every frame rebuilds and publishes all presented points, even when nothing reads them
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
Start with the rolling transform presentation track in packages/charts-core/src/motion.ts and the handlePresentationPoints path in packages/charts-core/src/renderer.ts. Reproduce by streaming data into a rolling line chart with no pointer or focus, then profile a roll to confirm the per-frame work. Compare the two proposed approaches and check that presented points are available when interaction begins while idle frames avoid unnecessary rebuilds, publishes, and filtering.
由索引模型根据 Issue 内容生成。
描述
A rolling-window chart pays a per-frame cost proportional to its row count for points nothing reads.
- Each rolling
transformplan gets a presentation track whoseapplyre-creates every point of the element, plus the exiting ones, as{ ...point, x, y }keyed bypointIdentity(point)(motion.ts:3442-3453). - Every tick then calls
lifecycle.publish(motion.ts:3999), which copies the whole map into a new array (motion.ts:3598). - The renderer's
handlePresentationPointsfilters that array withviewportInteractionPointsbefore it checks for a pointer or a focused point, so with neither the result is discarded (renderer.ts:1223-1246).
Use case: a live line that streams back to back 600 ms rolls of about 220 smoothed rows per mark (area, line and tail). With per-track timers, the points track is 77% of each frame's sampling (0.13 ms per call). In a production build the motion tick is about 0.23 ms per frame, about 131 ms of requestAnimationFrame time per 6 s of streaming, with no pointer over the chart. The DOM writes the roll needs are a small part of that.
Repro
Mount any line chart with a rolling window and keep appending data with no pointer and no focus. Profile one roll: apply runs on every frame for every row, and handlePresentationPoints runs viewportInteractionPoints every frame and then returns.
Proposal
Either:
- derive presented points lazily from the plan's transform when a subscriber or
getPresentationPointsactually needs them; or - skip the per-frame rebuild, publish and filter while there is no pointer, focus or tooltip, and publish once when one appears.
Related: #195 (rolling windows). Checked against 57774e14a1a86081eddb3a23523724a40da05640 (v1.1.0).
- 主要语言
- TypeScript
- 星标
- 819
- 派生
- 49
- 平均合并
- 12 小时 9 分钟
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/charts 的其他 Issue
-
[Bug] Focus guides: `url(#id)` paints ignore `idPrefix`可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
维护者通常 1 天内回复
-
brushX with `values` can shorten the selection range when it’s dragged to the plot edge可能已有人在做 @andersk 于 6 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 42/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 57/100
维护者通常 1 天内回复
相似的 Issue
-
ai-driven-qa bug claude Minor
难度 2/5 1-3 小时 新手友好度 70/100
linagora/twake-contacts-frontend#241 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
ui(ListToolbar): search takes the full row on a phone instead of sharing it with the result count未关闭
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
priority:high
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
ahmedkhaleel2004/gitdiagram#228 ·