Charts: Remove repeated `ChartData.Values` snapshots
Merged
CO
2mo ago+78+78+01234567890123456789-54-54-01234567890123456789
Internal chart calculations repeatedly materialized ChartData.Values, causing unnecessary allocations for large series while preserving the public snapshot API.
- Live enumeration: Enumerate
Pointsdirectly so currentChartPoint.Yvalues are returned. - Consumer cleanup: Replace snapshot-based
Count, indexing, aggregation, and enumeration withCount,GetValue, and directChartDataiteration across chart types, excluding HeatMap. - Equality and hashing: Preserve
ChartSeriesequality and first-ten-values hash semantics without snapshots. - Coverage: Add tests proving generic and non-generic enumeration observes mutated point values.
data[1].Y = 20.0;
data.ToList(); // [1.0, 20.0]
((IEnumerable)data).Cast<double>(); // [1.0, 20.0]
Measured after merge
| chart | before | after |
|---|---|---|
| line, 2 series × 500 points | 22,824,168 B / 29.3 ms | 5,680,216 B / 12.9 ms (−75.1% / −56%) |
| bar, 2 series × 200 points | 5,815,000 B / 6.3 ms | 2,255,384 B / 3.5 ms (−61.2% / −45%) |
The largest single allocation saving of any change in this release. Rendered output is unchanged.
Instrument: a bare Renderer whose UpdateDisplayAsync does nothing, so the figures are render-tree work only. Release build, median of 5, this commit measured against its own parent so the numbers belong to this change alone.