[Perf] Pointer moves: screen-CTM read and interaction-point rebuild on every move, and no early-input option
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- d3, typescript
调研方向
Start with packages/charts-core/src/renderer.ts at handlePointerMove, clientToScene, and interactionPoints, then read svg-coordinates.ts and related issue #190 for the strategy API context. The report measures pointer handling and describes two proposed improvements, but implementing them requires decisions about caching invalidation and the public pointer input API. Done means the selected performance and early-input behavior is implemented and verified against the reported interaction and pointer-leave cases.
由索引模型根据 Issue 内容生成。
描述
Hover cost and hover latency both come from the same move handler.
A. Work per move, even when focus does not change
handlePointerMoveresolves the pointer on every move (renderer.ts:739-753).- That calls
clientToScene, which readsgetScreenCTM()and inverts it (renderer.ts:636-643, svg-coordinates.ts:9-24). After any style write this forces a layout flush. - It then rebuilds
interactionPoints()and runs the strategy (renderer.ts:1169-1191). updateFocusreturns early on an unchanged point only after all of that (renderer.ts:545-555).
Measured in Chrome (radar, 3 polygons, custom focus.resolve, 300 moves inside one polygon, 3 runs): 0.13-0.18 ms per move in the handler. The strategy itself is 0.004-0.011 ms. The same chart drawn with per-polygon mouseenter costs 0.035-0.05 ms.
B. No way to use earlier pointer input
Chrome aligns pointermove to the frame. On a line chart at 1440 px, about 8 ms of the 9.7 ms median from input to the next painted frame is this wait. pointerrawupdate arrives 0.5-2 ms after the input, but the renderer only listens to pointermove. Driving setControlledFocus from it makes the owner 'controlled', so pointer leave no longer clears focus (see the comment on #189).
Proposal
- A: cache the inverse CTM until a resize or scene update, and let a strategy say the pointer is still inside the current focus (for example
contains(x, y)) so the controller skips the rebuild. - B: an option such as
pointerEvent: 'pointermove' | 'pointerrawupdate'(falling back where unsupported), or a public method that applies a pointer sample with the same leave and tooltip handling as the move handler.
Related: #190 (what a strategy can see). Checked against 57774e14a1a86081eddb3a23523724a40da05640 (v1.1.0).
- 主要语言
- TypeScript
- 星标
- 870
- 派生
- 57
- 平均合并
- 11 小时 58 分钟
- 30 天内合并 PR
- 18
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/charts 的其他 Issue
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per node未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
[Bug] Focus guides: `url(#id)` paints ignore `idPrefix`可能已有人在做 @getdownandcode 于 37 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Add reverse options to waffleY and waffleX可能已有人在做 @tannerlinsley 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 25/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
fb55/htmlparser2#2579 ·
维护者通常 1 天内回复
-
bug good first issue needs-review
难度 1/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
documentation public
难度 1/5 1-3 小时 新手友好度 68/100
midnightntwrk/umbradb#65 ·
维护者通常 2 天内回复
-
area/channels kind/bug priority/medium
难度 2/5 1-3 小时 新手友好度 78/100
nanocoai/nanoclaw#4501 · 1 条评论 ·
维护者通常 1 天内回复
-
needs verification
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 13 天内回复