[Perf] Pointer moves: screen-CTM read and interaction-point rebuild on every move, and no early-input option

未关闭
#203 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 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

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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TanStack/charts 的其他 Issue

查看 TanStack/charts 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。