Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Perf] Rolling motion: every frame rebuilds and publishes all presented points, even when nothing reads them

Aperta
#201 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

A rolling-window chart pays a per-frame cost proportional to its row count for points nothing reads.

  • Each rolling transform plan gets a presentation track whose apply re-creates every point of the element, plus the exiting ones, as { ...point, x, y } keyed by pointIdentity(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 handlePresentationPoints filters that array with viewportInteractionPoints before 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:

  1. derive presented points lazily from the plan's transform when a subscriber or getPresentationPoints actually needs them; or
  2. 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).

Lingua principale
TypeScript
Stelle
819
Fork
49
Merge medio
4h 40m
PR unite (30g)
16

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TanStack/charts

Tutte le issue di TanStack/charts

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.