Skip to content

Commit 3d79e07

Browse files
committed
Correct the pane-sweep probe counts and separate shimmed from true latency
1 parent 9237399 commit 3d79e07

2 files changed

Lines changed: 27 additions & 7 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Reading a native task's pane state verified every pane's ownership twice — once while recovering the pane set from disk, once again while listing the panes — so a six-pane read forked 48 `ps` probes where 24 answer the question. Recovery now hands back the snapshots it already proved, halving the probe count at every pane count with dead-pane reconciliation, restart/reattach and cross-process ownership unchanged.
1+
Reading a native task's pane state verified every pane's ownership twice — once while recovering the pane set from disk, once again while listing the panes — so a six-pane read forked 24 `ps` processes where 12 answer the question. Recovery now hands back the snapshots it already proved, halving the probe count at every pane count with dead-pane reconciliation, restart/reattach and cross-process ownership unchanged.

decisions/194-single-sweep-pane-state-read.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,26 @@ and tree work — the read was entirely probe-bound.
1212

1313
## Investigation
1414

15-
Measured with `scripts/measure-native-pane-latency.ts`, which now counts real
16-
`ps` invocations through a shim first on `PATH`. Six-pane read: 24 `ps` before,
17-
12 after collapsing the duplicate. Wall clock on an idle machine: p50 209 → 107 ms.
15+
Measured with `scripts/measure-native-pane-latency.ts`, real hosts, macOS. It
16+
answers two different questions and they must not be mixed:
17+
18+
**Deterministic probe count (counting on).** A shim first on `PATH` tallies every
19+
`ps` exec. Six-pane read: **24 `ps` processes before, 12 after** — two sweeps
20+
versus one, two pids per pane. Per pane count, before → after: 1 pane 4 → 2,
21+
2 panes 8 → 4, 4 panes 16 → 8. This number is load-independent and is the real
22+
evidence. Its wall clock is **not** usable: the shim forks a `/bin/sh` per probe
23+
and roughly doubles both arms (it read p50 209 → 107 ms, an inflated figure).
24+
25+
**True latency (`DEV3_PANE_LATENCY_COUNT_PROBES=0`).** No shim, base and fix
26+
interleaved in one run, n=15 per point, machine load 3–6, two rounds:
27+
28+
| Six-pane state read | Before | After |
29+
|---|---|---|
30+
| p50 | 75.5 / 82.3 ms | **40.4 / 38.1 ms** |
31+
| p95 | 140.2 / 128.4 ms | 60.3 / 83.3 ms |
32+
| min | 64.8 / 65.2 ms | 31.0 / 32.3 ms |
33+
34+
One sweep is the floor, and it sits at ~38–40 ms p50 for six panes on macOS.
1835

1936
The obvious next step — one batched `ps -p <csv> -o pid=,lstart=` per sweep
2037
instead of 2N single-pid forks — was implemented, covered and then **dropped**,
@@ -27,9 +44,12 @@ because on macOS `ps` with a pid list is pathologically slow:
2744
| `ps -p <pid> -p <pid> -o pid=,lstart=` | ~120 ms |
2845
| `ps -ax -o pid=,lstart=` | ~50 ms |
2946

30-
One batched call therefore cost more than twelve single-pid forks: measured
31-
six-pane read p50 148 ms batched versus 107 ms unbatched, and 150 ms versus
32-
26 ms for a single pane, where the batch is pure overhead.
47+
One batched call therefore cost more than twelve single-pid forks. Measured in
48+
the same counting-on round, so both figures carry the shim's inflation and only
49+
their ratio matters: six-pane read p50 148.8 ms batched versus 107.2 ms
50+
unbatched, and 150.4 versus 25.8 ms at a single pane, where the batch is pure
51+
overhead. The probe count did drop to exactly 1 `ps` per sweep — the batch
52+
worked, it was simply slower.
3353

3454
## Decision
3555

0 commit comments

Comments
 (0)