perf: the producer's group test is a mask, not a 64-bit division
`plan_partition()` only ever chooses powers of two for `time_stride`, and the comment there already claimed the test was cheap -- but the stride is a runtime value, so `tick % period` compiled to a real division that the hot loop paid once per channel per wire sample. The per-channel masks are built where the partition is already reacted to, and the shared clock's group end is computed once per sample instead of three times. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
ee660c14fd
commit
84c158ff21
3 files changed
+41
-10
No files matched your search
+5
-2
@@ -118,8 +118,11 @@ Partition plan_partition(const std::vector<double>& channel_dt, double buffer_by
|
||||
// Only now, with the ring as long as the budget can buy, decimate the shared clock
|
||||
// enough for the requested window to fit in it: deciding this earlier would over-
|
||||
// decimate by whatever factor the growth loop was about to add. A power of two keeps
|
||||
// the ring capacities (themselves powers of two) in step and keeps `tick % period`
|
||||
// cheap. The cap stops a nonsense request -- a window far past `--max-window` -- from
|
||||
// the ring capacities (themselves powers of two) in step and lets the producer's group
|
||||
// test be a mask (`Acquisition::acc_mask_`) rather than a modulo -- a modulo on a stride
|
||||
// this function chose at runtime is a real 64-bit division, which the test *was* paying
|
||||
// once per channel per wire sample.
|
||||
// The cap stops a nonsense request -- a window far past `--max-window` -- from
|
||||
// spinning here; at 2^20 the stored rate is six decades below the wire rate and the
|
||||
// picture is averages of averages anyway.
|
||||
u64 m = 1;
|
||||
|
||||
Reference in new issue
Block a user