Files
tiresiasfromthebai 9ef82fb898 perf: coalesce Array Visualizer rebuilds and halve scatter restyle
In scatter mode a two-array (X/Y) plot rebuilt the table and chart once
per property setter (data, offset, stride) and restyled every marker four
times, so a ~4000-point phase portrait froze for ~0.8s per refresh.

- SeerArrayWidget: add a BulkUpdate RAII guard that defers create() until
  a burst of setters completes, so a refresh does one rebuild, not several.
- redecorateScatterSeries: drop the two redundant transparent passes; after
  addSeries() the series holds the theme pen/brush, so setPen(NoPen)/
  setBrush() are already real transitions and either re-pushes both to the
  markers.

~800ms -> ~200ms per refresh at 4000 points; line/spline and marker
appearance unchanged.

Add tests/helloscatter, a 4000-point two-array phase portrait with a
breakpoint loop, to reproduce the slow refresh.
2026-07-31 10:55:43 +02:00

50 lines
1.1 KiB
C++

#include <cstdio>
#define NPOINTS 4000
double pos[NPOINTS];
double vel[NPOINTS];
//
// Fill pos/vel with the trajectory of a damped harmonic oscillator
// (semi-implicit Euler integration).
//
void integrate (double damping) {
double x = 1.0;
double v = 0.0;
double w = 1.0;
double dt = 0.005;
for (int i=0; i<NPOINTS; i++) {
v += (-w*w*x - damping*v) * dt;
x += v * dt;
pos[i] = x;
vel[i] = v;
}
}
//
// Exercises the Array Visualizer with a large two-array scatter plot.
//
// Open the Array Visualizer, enter 'pos' as array A and 'vel' as array B,
// length 4000, select B's axis as 'Y', scatter mode, and check 'Auto'.
// Then set a breakpoint on the printf below and 'Continue' a few times:
// each stop recomputes the trajectory with a different damping and
// refreshes the 4000-point phase portrait.
//
int main (void) {
for (int run=0; run<10; run++) {
double damping = 0.05 + 0.05*run;
integrate(damping);
printf("run %d: damping=%.2f pos[end]=%f\n", run, damping, pos[NPOINTS-1]);
}
return 0;
}