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

オープン
#203 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
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分
マージ済み PR(30日)
18

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/charts のほかの issue

TanStack/charts の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。