perf: editing a math graph recomputes that graph, not every channel
`set_math_channels()` rebuilt the store for any change, and a rebuild replaces the buffer:
every channel in the window started again, which is the "modifying one expression invalidates
all the others" report.
The plan is a *partition over the channels*, so it only moves when the set moves. When the
set is unchanged -- same channels, names and enables -- nothing is rebuilt now: the store is
untouched, every other channel keeps its samples and its runtimes, and the surgical path
prepares and recomputes only the affected graphs. The affected set is the edited channels plus
whatever *names* them, because one channel's output is another's input, and the recompute
computes the whole list in order (the inputs have to be there) while writing only those in
the mask -- which is why the step-loop is now `math_apply_locked(sample, write_mask, timed)`.
Adding, removing or renaming a channel still moves the plan, and still rebuilds.
[math-probe] graph edit: stored_slots 800 -> 900 (want the second at least the first, and non-zero)
The count grows because the stream keeps filling while the edit runs; the point is that it
never falls to 0, and that every channel afterwards still reads `N samples vs M time slots`
with N == M.
This commit is contained in:
1 parent
8b3240cacb
commit
5eb20f3cdb
5 files changed
+154
-4
No files matched your search
@@ -281,6 +281,15 @@ class ScopeModel {
|
||||
/// evaluated from those, in order, so a math channel may use another one.
|
||||
void push_math_sample(const std::vector<f32>& sample);
|
||||
|
||||
/// Applies the graphs to one stored slot. `write_mask`, when given, names the derived channels whose
|
||||
/// rings may be written -- `nullptr` writes all of them, which is what the producer does; a recompute
|
||||
/// passes the channels a graph change actually affects, so the others keep the samples they have.
|
||||
void math_apply_locked(const std::vector<f32>& sample, const std::vector<bool>* write_mask, bool timed);
|
||||
|
||||
/// Recomputes the derived channels in `affected` from the samples the store already holds: their rings are
|
||||
/// rebuilt from scratch, and the channels a chart change does *not* touch are left exactly as they were.
|
||||
void recompute_math_locked(const std::vector<bool>& affected);
|
||||
|
||||
/// How many slots the store currently holds. A file view reads it to tell a structural change that
|
||||
/// dropped the buffer (0) from one that could not have (see `reload_file_view()` in ui.cpp).
|
||||
std::uint64_t stored_slots();
|
||||
|
||||
Reference in new issue
Block a user