Rolling transforms rebuild and publish every presented point on every frame, even with no pointer or focus
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- data-visualization, performance
Research direction
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.
Written by the indexing model from the issue text.
Description
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).
- Dominant language
- TypeScript
- Stars
- 819
- Forks
- 49
- Avg merge
- 12h 9m
- Merged PRs (30d)
- 6
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TanStack/charts
-
Renderer treats a sub-pixel width difference as a resize, which cancels the `motion()` entranceOpen
Difficulty 1/5 Under an hour Newbie friendliness 85/100
TanStack/charts#182 · 1 comment ·
Maintainers usually reply within 1 day
-
brushX with `values` can shorten the selection range when it’s dragged to the plot edgePossibly taken @andersk claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Grid and axis lines have no `shape-rendering` option, so hairlines anti-alias across two device rowsOpen
Difficulty 3/5 1-2 days Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
microsoft/playwright#43327 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/TypeScript#64758 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
opensearch-project/OpenSearch-Dashboards#12937 ·
Maintainers usually reply within 2 days
-
Liveness marks block-included attesters live in the block's epoch instead of the attestation's epochOpen
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
status: needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
a2ui-project/a2ui#3158 ·
Maintainers usually reply within 2 days