Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 48 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,14 @@ An op can name a tick that has not been recorded yet. The server says so (`pendi

### Picking a `capacity`

`capacity` is the only number `Viz::new` asks for that has no right answer — it is RAM traded
against reactivity, and the exchange rate is your graph's, not this crate's. What it constrains:
`capacity` is the only number `Tape::new` asks for that has no right answer — it buys scrollback with
RAM, and the exchange rate is your graph's, not this crate's. What it constrains:

| | |
|---|---|
| `capacity / 2` | the newest ticks kept **whole** — the stretch that stays tick-exact |
| `capacity / 4` | the ceiling on the thinned *backbone*, and so how deep the squeeze goes |
| `capacity / 2` | the recycle channel's depth: one pass frees between a quarter and a half of the buffer, and the recorder takes all of it back rather than allocating |
| `capacity` | the bound on the carry-forward scan a frame does for every quiet node, which is what landing a cursor costs |

Thinning is **per node, not per tick**: a pass raises the exponent of whichever node is claiming most
of the backbone until the backbone fits, so a node firing 288 times a day keeps all 288 while the
Expand All @@ -108,40 +107,60 @@ that each want ~3 000 land on ~1 790 apiece, and everything rarer than that keep
had. Read the other way: a 5-minute bar over three days is 864 fires and is safe from about 8 000;
over a month it is 8 640 and wants ~65 000.

Bigger is not free, and the price is not where it looks. Recording cost does not move with
`capacity` at all — the graph thread's leg of a fire is the same two renderings either way. What
moves is the cost of *landing* a cursor, because a frame carries every node's standing value and a
node quiet for a while is found by scanning back for it.
Three prices, and they are not the same shape:

The block below is one synthetic graph on one machine. `Viz::bytes` is exported so the same reading
can be taken against yours.
- **Memory is linear**, and it is the one you actually pay. Roughly 550 B per retained tick for the
mix below; a 42-node graph runs nearer 2.4 KB.
- **Cursor latency is flat.** Every replay op is a binary search, so a keypress costs the same
against 260 000 retained ticks as against 2 000 — the whole latency column below is the loopback
socket, and the tape's own share does not clear the noise.
- **Absorption grows**, about 2× from 2 048 to 262 144. Not the graph thread — its leg of a fire is
the same two renderings either way — but the tape thread's, which allocates fresh columns where a
smaller buffer would have been handing recycled ones back. Under `Block` that is replay
throughput; under `Drop` it is not latency either, it is `dropped`.

The flat middle line was not always true. A frame carries every node's standing value, and a node
that has been quiet is found by searching back for its last fire — which used to be a linear scan. On
a 42-node graph holding a day, one node that fires twice a day was enough to put a scrub at 139ms,
growing with wherever the cursor sat. `Inner::fired` indexes it, and the mix below now carries a
twice-a-day node so that number cannot quietly go back to being one nobody waits for.

The block is one synthetic graph on one machine. `Viz::bytes` is exported so the same reading can be
taken against yours.

<!-- capacity:begin -->
```
318420 ticks (2 days at spl's 159210/day), 5 nodes, 107 B/tick of card faces
fires over the run: Book=318420 Screen=3185 Bar:1m=2895 Bar:5m=579 Bar:1h=49
318420 ticks (2 days at spl's 159210/day), 6 nodes, 107 B/tick of card faces
fires over the run: Book=318420 Screen=3185 Bar:1m=2895 Bar:5m=579 Bar:1h=49 Cap=4

footprint — Viz::bytes over the retained ticks
2048 │▬ 3.0 MB (1477 B/tick)
8192 │▬▬ 5.4 MB (818 B/tick)
20000 │▬▬▬▬ 11.3 MB (665 B/tick)
65536 │▬▬▬▬▬▬▬▬▬▬▬ 33.8 MB (554 B/tick)
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 132.6 MB (524 B/tick)

reactivity — /api/seek mid-tape *above* a bare 53µs loopback hop, median of 64
2048 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 13µs
8192 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 13µs
20000 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 13µs
65536 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 14µs
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 34µs
2048 │▬ 1.2 MB (701 B/tick)
8192 │▬ 4.0 MB (637 B/tick)
20000 │▬▬▬▬ 9.8 MB (594 B/tick)
65536 │▬▬▬▬▬▬▬▬▬▬▬▬ 34.1 MB (558 B/tick)
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 121.0 MB (548 B/tick)

reactivity — one /api/seek mid-tape, median of 64; the bare loopback hop under it is 53µs
2048 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 68µs
8192 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 66µs
20000 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 83µs
65536 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 66µs
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 68µs

absorption — the whole recording's wall clock per tick, tape-thread bound under `Block`
2048 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 761ns
8192 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 795ns
20000 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 957ns
65536 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 1258ns
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 1443ns

addressability — fires still reachable by `step_until`, against the run's own
capacity retained Book Screen Bar:1m Bar:5m Bar:1h
2048 2007 2007/318420 251/3185 231/2895 147/579 49/49
8192 6557 6557/318420 691/3185 899/2895 579/579 49/49
20000 16951 16951/318420 1796/3185 1784/2895 579/579 49/49
65536 61047 61047/318420 3185/3185 2895/2895 579/579 49/49
262144 252884 252884/318420 3185/3185 2895/2895 579/579 49/49
capacity retained Book Screen Bar:1m Bar:5m Bar:1h Cap
2048 1767 1767/318420 248/3185 229/2895 147/579 49/49 4/4
8192 6316 6316/318420 689/3185 897/2895 579/579 49/49 4/4
20000 16395 16395/318420 1793/3185 1781/2895 579/579 49/49 4/4
65536 61059 61059/318420 3185/3185 2895/2895 579/579 49/49 4/4
262144 220713 220713/318420 3185/3185 2895/2895 579/579 49/49 4/4
```
<!-- capacity:end -->

Expand Down
78 changes: 45 additions & 33 deletions docs/.readme_assets/other.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
### Picking a `capacity`

`capacity` is the only number `Viz::new` asks for that has no right answer — it is RAM traded
against reactivity, and the exchange rate is your graph's, not this crate's. What it constrains:
`capacity` is the only number `Tape::new` asks for that has no right answer — it buys scrollback with
RAM, and the exchange rate is your graph's, not this crate's. What it constrains:

| | |
|---|---|
| `capacity / 2` | the newest ticks kept **whole** — the stretch that stays tick-exact |
| `capacity / 4` | the ceiling on the thinned *backbone*, and so how deep the squeeze goes |
| `capacity / 2` | the recycle channel's depth: one pass frees between a quarter and a half of the buffer, and the recorder takes all of it back rather than allocating |
| `capacity` | the bound on the carry-forward scan a frame does for every quiet node, which is what landing a cursor costs |

Thinning is **per node, not per tick**: a pass raises the exponent of whichever node is claiming most
of the backbone until the backbone fits, so a node firing 288 times a day keeps all 288 while the
Expand All @@ -20,47 +19,60 @@ that each want ~3 000 land on ~1 790 apiece, and everything rarer than that keep
had. Read the other way: a 5-minute bar over three days is 864 fires and is safe from about 8 000;
over a month it is 8 640 and wants ~65 000.

Bigger is not free, and the price is not where it looks. Recording cost does not move with
`capacity` at all — the graph thread's leg of a fire is the same two renderings either way. What
moves is the cost of *landing* a cursor, because a frame carries every node's standing value and a
node quiet for a while is found by scanning back for it.
Three prices, and they are not the same shape:

The block below is one synthetic graph on one machine. `Viz::bytes` is exported so the same reading
can be taken against yours.
- **Memory is linear**, and it is the one you actually pay. Roughly 550 B per retained tick for the
mix below; a 42-node graph runs nearer 2.4 KB.
- **Cursor latency is flat.** Every replay op is a binary search, so a keypress costs the same
against 260 000 retained ticks as against 2 000 — the whole latency column below is the loopback
socket, and the tape's own share does not clear the noise.
- **Absorption grows**, about 2× from 2 048 to 262 144. Not the graph thread — its leg of a fire is
the same two renderings either way — but the tape thread's, which allocates fresh columns where a
smaller buffer would have been handing recycled ones back. Under `Block` that is replay
throughput; under `Drop` it is not latency either, it is `dropped`.

The flat middle line was not always true. A frame carries every node's standing value, and a node
that has been quiet is found by searching back for its last fire — which used to be a linear scan. On
a 42-node graph holding a day, one node that fires twice a day was enough to put a scrub at 139ms,
growing with wherever the cursor sat. `Inner::fired` indexes it, and the mix below now carries a
twice-a-day node so that number cannot quietly go back to being one nobody waits for.

The block is one synthetic graph on one machine. `Viz::bytes` is exported so the same reading can be
taken against yours.

<!-- capacity:begin -->
```
318420 ticks (2 days at spl's 159210/day), 5 nodes, 107 B/tick of card faces
fires over the run: Book=318420 Screen=3185 Bar:1m=2895 Bar:5m=579 Bar:1h=49
318420 ticks (2 days at spl's 159210/day), 6 nodes, 107 B/tick of card faces
fires over the run: Book=318420 Screen=3185 Bar:1m=2895 Bar:5m=579 Bar:1h=49 Cap=4

footprint — Viz::bytes over the retained ticks
2048 │▬ 1.4 MB (679 B/tick)
8192 │▬ 4.2 MB (639 B/tick)
20000 │▬▬▬ 10.0 MB (592 B/tick)
65536 │▬▬▬▬▬▬▬▬▬▬▬ 34.0 MB (557 B/tick)
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 138.2 MB (546 B/tick)
2048 │▬ 1.2 MB (701 B/tick)
8192 │▬ 4.0 MB (637 B/tick)
20000 │▬▬▬▬ 9.8 MB (594 B/tick)
65536 │▬▬▬▬▬▬▬▬▬▬▬▬ 34.1 MB (558 B/tick)
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 121.0 MB (548 B/tick)

reactivity — /api/seek mid-tape *above* a bare 55µs loopback hop, median of 64
2048 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 11µs
8192 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 12µs
20000 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 13µs
65536 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 13µs
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 31µs
reactivity — one /api/seek mid-tape, median of 64; the bare loopback hop under it is 53µs
2048 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 68µs
8192 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 66µs
20000 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 83µs
65536 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 66µs
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 68µs

absorption — the whole recording's wall clock per tick, tape-thread bound under `Block`
2048 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 567ns
8192 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 706ns
20000 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 956ns
65536 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 1085ns
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 1334ns
2048 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 761ns
8192 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 795ns
20000 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 957ns
65536 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 1258ns
262144 │▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ 1443ns

addressability — fires still reachable by `step_until`, against the run's own
capacity retained Book Screen Bar:1m Bar:5m Bar:1h
2048 2007 2007/318420 251/3185 231/2895 147/579 49/49
8192 6557 6557/318420 691/3185 899/2895 579/579 49/49
20000 16951 16951/318420 1796/3185 1784/2895 579/579 49/49
65536 61047 61047/318420 3185/3185 2895/2895 579/579 49/49
262144 252884 252884/318420 3185/3185 2895/2895 579/579 49/49
capacity retained Book Screen Bar:1m Bar:5m Bar:1h Cap
2048 1767 1767/318420 248/3185 229/2895 147/579 49/49 4/4
8192 6316 6316/318420 689/3185 897/2895 579/579 49/49 4/4
20000 16395 16395/318420 1793/3185 1781/2895 579/579 49/49 4/4
65536 61059 61059/318420 3185/3185 2895/2895 579/579 49/49 4/4
262144 220713 220713/318420 3185/3185 2895/2895 579/579 49/49 4/4
```
<!-- capacity:end -->

Expand Down
Loading
Loading