repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

docs(research): 4KD6V6IH promotion results and measured bounds

aba9ac391b821ae7959c928aaa3aed6363b56ff4

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (1)

+30 / −4 text lines

Diff layout

.system/research/SMH-RESEARCH-4KD6V6IH-concurrency-and-memory-shape/index.md

Modified

+30 / −4 text lines

1721723. Spike B (`ureq`) after deciding trust-store policy and pinning `~3.4`; delete reqwest engine and workspace entry.
1731734. Hot-spot refactors with count bounds: `ancestry` → request build → spool → `Value` payloads.
175## Promotion results (2026-09-26, stack `tlszyzws..wqptrptw`)
177All three spikes promoted after spec text landed (SMH-SPEC-WASM0001 Sealed WASI; SMH-SPEC-SPEC0001 network transport, memory accounting, index arena).
179| measure | before | after |
180|---|---|---|
181| crates in normal graph | 298 | 210 |
182| lockfile packages | 370 | 294 |
183| async runtime in graph | tokio via reqwest and wasmtime-wasi | none |
184| `Mutex` in library production code | 5 sites | 0, enforced by `cargo x arch` |
185| `fork_at(1000)` allocations | 2020 | 3 |
186| `Session::from_frames(1000)` allocations | unmeasured | 5, equal at 100 entries |
187| mock eval turn allocations | 222 | 42 |
189What moved each number:
191- `ancestry` as branch prefix: 2020 → 2002 (the floor of owned `Entry` clones).
192- Session arena (SMH-PLAN-82POBOKB): `Entry` is a `Copy` record over one `Vec<u8>` arena, content is canonical CBOR bytes decoded on demand, frames embed content as one byte string (`VERSION_ENTRY = 2`): 2002 → 3, load constant, turn 220 → 208.
193- `Arc<[ToolMetadata]>` registry snapshot on `ProviderRequest.tools` instead of a per-request sorted clone of every schema: 208 → 42.
194- Provider records over bounded `mpsc`, single-pass masked request build: 222 → 220 in-process (the first turn per process pays +1 allocation of lazy global init; bounds are steady state after a warm-up).
195- HTTP body channel bounded (16 chunks) and terminated by an explicit `HttpBodyEnd`; RPC worker owns the agent, reader owns responses, two atomics plus channels.
197Decisions taken on the way: bundled Mozilla roots for TLS (`platform-verifier` deferred); `record_channel` bound 64 with a documented per-round invariant; `smith-alloc` counters stay global atomics (≈ 12 ns per allocation) until a hot path shows the cost; per-frame content `Vec` on load accepted until the reader hands slices.
199Remaining floor of the mock turn (42): request encoding, stream event vectors, two entry encodes and frame writes; next candidates are a slice-handing frame reader, a borrowed `EntryContent` view at record time, and a per-session text pool.
175201## Open questions
177203- Kernel pool sizing: lazy pool capped at cores vs one thread per plugin.
178204- Render tick: fixed 60 Hz vs on-demand with deadline.
179- Trust store for ureq: bundled roots vs `platform-verifier`.
180- Sealed WASI breadth: which further imports (random seed, wall-clock, filesystem) get Smith substitutes before a non-trivial guest std program runs.
181- Per-turn peak: reset or epoch API on `smith-alloc`.
205- Sealed WASI breadth: which further imports (random seed, wall-clock, filesystem) get Smith substitutes before a non-trivial guest std program runs; `monotonic_now` is still never injected.
206- Per-turn peak: reset or epoch API on `smith-alloc`; thread-local counters.
207- Trust store: revisit `platform-verifier` when a corporate proxy case appears.
183209## Sources
185- Code and lockfile at `tztonmyo` (`dd069f92`); spike changes `qwzlzyqk`, `lnrvruyv`, `onllulxs`.
211- Code and lockfile at `tztonmyo` (`dd069f92`); spike changes `qwzlzyqk`, `lnrvruyv`, `onllulxs`; promoted stack `tlszyzws` through `wqptrptw`.
186212- Registry sources: `wasmtime-wasi 49.0.1`, `wasmtime-wasi-io 49.0.1`, `ureq 3.4.2`, `ureq-proto 0.6.4`.
187213- SMH-SPEC-WASM0001 (sealed WASI law, single-threaded instances), SMH-SPEC-SPEC0001 (bounded frame allocation).
188214- SMH-RESEARCH-RSCH0001 (arena patterns), SMH-RESEARCH-RSCH0010 (session size distribution: p99 ≈ 9 MiB JSONL, compaction near 250k tokens).