Skip to content

perf(s2): compute hover deemphasis opacity once per series - #1002

Merged
c-lamoureux merged 1 commit into
mainfrom
perf/s2-line-group-opacity
Oct 9, 2026
Merged

c-lamoureux merged 1 commit into
mainfrom
perf/s2-line-group-opacity

Conversation

@c-lamoureux

Copy link
Copy Markdown
Contributor

What

  • hoverFractionData gets a deemphasisOpacity formula field, so each series' faded opacity is computed once per animation row instead of once per data point.
  • Line, bar and donut opacity read it via hoverFraction(..., 'deemphasisOpacity'); hoverFraction gains an optional field argument (defaults to fraction).
  • No visual change: the formula is the same FADE_FACTOR + (1 - FADE_FACTOR) * ramp(fraction) expression, moved into the data.

Why

With the CSP-safe interpreter, every vertex evaluated the full ramp expression on each hover animation frame. Moving it to one row per series removes that per-vertex math.

Perf

  • Opacity interpreter nodes per call: 19 → 9; interpreter nodes per line vertex: 43.5 → 34.6 (−20%).
  • Headless dataflow benchmark, line 30 series × 10 points: ~1.0 → 0.85 ms per frame (~15%, consistent across 3 alternating pairs).
  • Browser line hover dashboard: no measurable fps change. Hover is render-bound there, so this mainly frees script time.

Testing

  • Unit tests for the new field, the hoverFraction field argument, and updated line, bar and point opacity expectations.
  • S2 only; S1 has no hover animation code.

…tionData

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@c-lamoureux
c-lamoureux marked this pull request as ready for review October 9, 2026 22:10
@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@c-lamoureux
c-lamoureux merged commit 3fa8b20 into main Oct 9, 2026
7 checks passed
@c-lamoureux
c-lamoureux deleted the perf/s2-line-group-opacity branch October 9, 2026 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants