From d486379b91df8a2f4d93fb5de3dce8e02637e7ef Mon Sep 17 00:00:00 2001 From: "@permadeath.com" Date: Fri, 28 Aug 2026 00:04:40 -0400 Subject: [PATCH] perf(local-dev): stop generating debug information nobody reads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nothing here is debugged by stepping and a backtrace needs only line tables. Measured from cold into a target directory per setting: 1.1 GB to 827 MB of target, 106 MB to 43 MB of binary, 59.6 s to 47.2 s of build — and four live worktrees have filled this machine mid-link more than once. Change-Id: Ie838e27112bdc25883027c11ecb3fa70f72072ce --- Cargo.toml | 27 +++++++++++++++++++++++++++ plan/local-dev.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 2eda64df..b25c627a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,6 +67,33 @@ time = { version = "0.3", features = ["formatting", "parsing", "macros"] } toml = "0.9" tower = { version = "0.5", features = ["util"] } +# Debug information is most of what a build of this workspace produces, and +# almost none of it is used. Nothing here is debugged by stepping: the server +# is watched through its log, and a failure arrives as a backtrace. Line tables +# are what a backtrace needs — file and line for every frame — and they are a +# fraction of the size of the full DWARF a stepping debugger wants. +# +# Measured by building `vibescrobble-dev` from cold into a target directory of +# its own, once with each setting, so that neither answer was polluted by +# artefacts of the other: the target directory went from 1.1 GB to 827 MB, the +# binary from 106 MB to 43 MB, and the build from 59.6 s to 47.2 s. The +# workspace as a whole gains more than that share, because the facade crate's +# test binaries link every crate in it and there is one per suite. +# +# It matters beyond the seconds: four live worktrees have filled this machine's +# disk mid-link more than once, and the failure reads as the linker crashing +# rather than as a full disk. +# +# Set `debug = true` here, temporarily, if you do need a stepping debugger. +[profile.dev] +debug = "line-tables-only" + +# The same for test binaries, which are the largest artefacts in the tree: the +# suites in the facade crate link every crate in the workspace, and there is +# one such binary per suite. +[profile.test] +debug = "line-tables-only" + [workspace.lints.rust] missing_docs = "warn" diff --git a/plan/local-dev.md b/plan/local-dev.md index 616cd962..f418f64b 100644 --- a/plan/local-dev.md +++ b/plan/local-dev.md @@ -26,8 +26,50 @@ workable without a deployment. capable code. Agents in cloud sandboxes as well makes browser isolation moot and unlocks instance-identity attestation. +## The inner loop, measured + +A one-crate incremental rebuild of the development server is about two +seconds. A full `dev-pds.sh` cycle after a change to `vibescrobble-pds` is +about fourteen, of which four is running that half's tests and the rest is +compiling and linking. `cargo install` of the hook binary reuses what the +tests just built and costs a second or so, which is what its comment in the +script claims. + +So the compile is not where the time goes. What the build costs is *disk*, and +that is what fills a machine: see the dev profile under Done. + +- [ ] **Watch modes, for the components where a restart is free.** The index, + the query service and the scrobble host are stateless: something that + rebuilt and restarted them on a change would cost nothing but the build. + A personal data server is not — without `--data` a restart is a factory + reset, and every live session's account goes with it. So a watch on that + one has to refuse, or demand `--data`, rather than being the same flag + spelled the same way. That asymmetry is the whole design, and a watcher + that did not know it would be a way to lose a morning. +- [ ] **Capture and replay a firehose.** Working on the index, the query + service or the canvas needs a personal data server and a swarm, and the + canvas already has a mock for exactly that reason. A recording of a real + stream, replayed into an index with nothing else running, would extend + that one layer down and make a read-side bug reproducible rather than + re-provoked. +- [ ] **A `--data` directory has no idea what wrote it.** A developer keeps + one for a week; the shape of a log entry changes underneath them. Serde + fills a defaulted field and ignores an unknown one, so an entry can parse + and mean something else, and the deployment starts up looking healthy. + [deploy](deploy.md) carries the production half of this; the local half + is that a stale data directory should say so rather than replay wrong. + ## Done +- [x] **A dev profile that stops generating what nobody reads.** Debug + information was most of what a build produced and almost none of it was + used: nothing here is debugged by stepping, and a backtrace needs only + line tables. Measured by building the development server from cold into + a target directory of its own under each setting, so neither answer was + polluted by the other's artefacts — 1.1 GB to 827 MB of target, 106 MB to + 43 MB of binary, 59.6 s to 47.2 s of build. The workspace gains more than + that share, because the facade crate's test binaries link every crate in + it and there is one per suite. - [x] **Simulate failure, not only the happy path.** A server that goes away mid-stream is now a test: `crates/vibescrobble/tests/firehose.rs` cuts a subscriber's connection, keeps writing records it cannot see, and -- 2.51.2