Skip to content
Source
Sign inSign up
TanStack/charts

perf: skip sunburst boundary sampling during animation #224

Mergedtannerlinsleymerged 3 commits intomain fromtaren/sunburst-path-projectionmerged by tannerlinsley

tannerlinsleycommented

Change

Sunburst animation frames only need an SVG path, but were also rebuilding sampled hit-test boundaries. Separate path projection from boundary sampling and reuse the existing D3 arc defaults. Initial scene construction still builds interaction boundaries.

Found while investigating the polar animation report from @toomingos in #194. This does not resolve that issue or include the held rounded-arc changes.

Verification

  • All 19 validation tasks pass, including 2,234 core tests and nine new projection regression cases.
  • Maintained example builds and sunburst conformance pass.
  • Chromium, Firefox and WebKit produce identical before/after paths, including all 30 sampled nested animation frames, with clean teardown.
  • All existing bundle limits pass without changes. Sunburst gzip: 7.599 to 7.571 kB. Radial-bar gzip: 27.773 to 27.765 kB.
  • Seven measured paired Chromium trials at 1,000 sectors: 30 flat animation frames improve from 19.2 to 14.9 ms, nested frames from 27.5 to 22.4 ms. Ten scene builds measure 6.7 to 6.4 ms flat and 8.8 to 8.9 ms nested. These are isolated local measurements, not whole-app throughput claims.
  • All 188 generated preview images stay unchanged. Only their source fingerprint and comparison provenance change.

Includes a patch Changeset. No public API or dependency changes.

Summary by CodeRabbit

  • Performance Improvements
    • Sunburst chart animations avoid rebuilding hit-test boundaries for each projected frame, reducing repeated work while keeping the chart’s displayed behavior unchanged.
  • Documentation
    • Updated chart comparison pages to reflect the latest workspace revision and bundle snapshot date.
    1. 🦋 Changeset detected

      Latest commit: e9e894f46910dda26c50f6773d5f0d6fbfed705d

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 12 packages
      NameType
      @tanstack/chartsPatch
      @tanstack/alpine-chartsPatch
      @tanstack/angular-chartsPatch
      @tanstack/lit-chartsPatch
      @tanstack/octane-chartsPatch
      @tanstack/preact-chartsPatch
      @tanstack/react-chartsPatch
      @tanstack/react-native-chartsPatch
      @tanstack/solid-chartsPatch
      @tanstack/svelte-chartsPatch
      @tanstack/vue-chartsPatch
      @tanstack/charts-scalesPatch

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: defaults
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: b9370423-ad88-493e-b1e4-2d972e648fe5
      📥 Commits

      Reviewing files that changed from the base of the PR and between 5a34b7e14d85ff8c7b7248fedb2fd9731cacbd67 and e9e894f46910dda26c50f6773d5f0d6fbfed705d.

      📒 Files selected for processing: 8
      • .changeset/sunburst-path-projection.md
      • benchmarks/comparison/bundle-baseline.json
      • benchmarks/conformance/previews/manifest.json
      • docs/comparison.md
      • packages/charts-core/docs/comparison.md
      • packages/charts-core/src/hierarchy-sunburst.ts
      • packages/charts-core/src/polar-sector-internal.test.ts
      • packages/charts-core/src/polar-sector-internal.ts

      Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

      📝 Walkthrough

      The sunburst path projection now uses a dedicated polar-sector projector. Tests cover projected paths, resolved boundary points, repeated projection, and invalid sector values. Benchmark and comparison metadata identify updated source revisions and dates.

      Changes: Sunburst sector projection

      Layer / File(s)Summary
      Polar-sector projection and sunburst integration
      packages/charts-core/src/polar-sector-internal.ts, packages/charts-core/src/hierarchy-sunburst.ts, packages/charts-core/src/polar-sector-internal.test.ts, .changeset/sunburst-path-projection.md
      projectPolarSector generates sector paths. projectSunburstSectorPath now uses it instead of resolving the sector boundary. Tests cover projected paths, resolved points, repeated projection, and invalid values. A patch changeset records the change.
      Benchmark and comparison revision metadata
      benchmarks/comparison/bundle-baseline.json, benchmarks/conformance/previews/manifest.json, docs/comparison.md, packages/charts-core/docs/comparison.md
      The baseline and manifest contain updated timestamps, revisions, and hashes. Both comparison pages identify the updated workspace revision and baseline date.

      Priority: ➖ Normal

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Refactor

      Suggested reviewers: greglum

      Merge Risk: ⚪ Minimal · up to e9e89

      The projection change is mergeable after normal checks; no actionable issue remains identified.

      Pre-merge checks: Passed 4 · Failed 1
      Failed Failed checks: 1 warning
      Check nameStatusExplanationResolution
      Docstring CoverageWarningDocstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (5 skipped: 5…Write docstrings for the functions missing them to satisfy the coverage threshold.
      Passed Passed checks: 4 passed
      Check nameStatusExplanation
      Description CheckPassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title checkPassedThe title clearly and concisely describes the main change: avoiding sunburst boundary sampling during animation.
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Docstring Coverage

      Explanation

      Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (5 skipped: 5 unsupported.)

      • Fix all pre-merge checks with AI
      ✨ Finishing Touches: 💡 1
      📝 Generate docstrings: 💡
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    3. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit e9e894f46910dda26c50f6773d5f0d6fbfed705d

      CommandStatusDurationResult
      nx run charts-workspace:ci-distributed✅ Succeeded2m 31sView ↗
      nx run charts-workspace:package-check✅ Succeeded<1sView ↗
      nx run charts-workspace:benchmark-check✅ Succeeded<1sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-10-14 02:16:06 UTC

    4. Follow-up timing check: the short nested scene-build samples differed by 0.1 to 0.2 ms across ten builds, so I repeated with 100 builds per sample. Two seven-pair runs measured median 91.9 to 91.6 ms and 87.1 to 87.6 ms. The small difference changed direction, so these measurements do not establish a repeatable scene-build regression. Thirty animation frames remained faster in both runs: 27.9 to 22.8 ms and 27.6 to 22.6 ms. All four CI stress partitions and all four comparison partitions have passed; static checks and review are still running.

    5. tannerlinsley merged thisd91e0a0

    6. tannerlinsley closed this

Sign in to join this conversation.