# Board diagnosis: the helper wasn't the bottleneck, `prepare()` was Follow-up to `README.md` in this same directory, after the coordinator ran the landed `perf/instant-theme-swap` work (`master` `b3183866`, plus the later `d87728a4` preview-race fix) on the reserved board, system `766yhn3l...`. This file is a **host + code-reading** diagnosis of that board run (the board run itself is the coordinator's own, not repeated here) plus the fix and instrumentation this worktree (`perf/instant-swap-board`, base `master` at `d87728a4` or later) adds. No board access from this worktree; nothing here is a new board measurement. ## The board numbers (coordinator's own run, timed directly with the installed `k230-theme`, shell user, chooser closed) | Command | Wall time | | --- | ---: | | `list --json` | 886-890 ms | | `preview ` (catppuccin/-latte, already prepared, has `background.cache`) | 3950-4095 ms | | `activate --json --expected-generation ` | 4183-4263 ms | `journalctl -u theme-helper --since -3min` showed no entries. `/run/shell/theme-helper.sock` existed, owned by `shell`. Before the daemon existed at all, `activate` took 2.8-3.5 s -- so the daemon made this *worse*, not better. ## Root cause (found by reading the actual code path, confirmed by a host measurement) `theme_activate.py`'s `prepare()` is called by every `preview`/`activate`, daemon-served or not. It used to check whether the destination generation already existed **only at the very end** -- after: 1. hashing the whole theme source tree (`source_digest`, reading every background image's full bytes) and the whole `omarchy-theme-tools` tree, 2. staging: copying every background image and config file into a scratch directory (`checked_copy`, a second full read-and-write of the same bytes `source_digest` just read), 3. invoking the external `omarchy-theme-color --all` helper (a bash script that itself spawns several `awk` subprocesses per call for colour mixing), 4. invoking `omarchy-theme-set-templates` (another bash script, which itself re-invokes `omarchy-theme-color --all` *again* internally, then runs `sed -f