---
name: defender-first-touch-tax-on-fresh-test-binaries
description: "On hfenduleam a freshly built binary pays ~1 s of Defender scan on FIRST execution; a suite that spawns thousands of fresh test binaries wears this as spawn latency, which reads as a slow box and turns every wall-clock budget in the suite into a coin"
metadata:
  node_type: memory
  type: project
---

**Measured 2026-09-09 by doyle**, from a hypothesis + falsifier I handed him during #272 golden r2.
Copy `spt.exe` (35 MB) to four fresh names, time each run:

- first run: 2092 / 994 / 1171 / 1043 ms
- second run of the same files: 31 / 263 / 19 / 260 ms
- an already-scanned source binary: 270 / 38 / 257 ms

`MsMpEng` on an otherwise idle box: 67.8 / 62.8 / 48.9 / 32.2 / 12.2 % of one core over 5 s. RTP
enabled, AV enabled. So a fresh binary pays roughly a SECOND on first touch, and a second run of
the same bytes pays almost nothing.

**Why this hides:** it is invisible in a core-count sample (the box reads ~1.1 of 16 cores busy),
it is not cargo (`cargo`/`rustc`/`nextest` all at 0 while it happens), and it lands on PROCESS
SPAWN — so a phase of thousands of small cells slows monotonically while every individual cell
still "passes". The visible symptom was Phase A pure-unit time climbing 448.7 -> 495.1 -> 542.6 s
across three attempts at ONE sha, alongside a rotating single Phase B victim (a 5 s ttl race, then
a 15 s `converge()`), which is the RANDOM-VICTIM signature: one env cause, N apparent flaky tests.
See [[a-widened-wall-clock-margin-is-a-longer-coin]] and [[e2e-leaked-daemons-shared-box]].

**How to apply:** on a box that is idle by every process meter yet getting slower per attempt, time
a fresh-copy binary against its second run before theorising about the product. The decisive
config row is NOT readable unelevated — `Get-MpPreference` returns
"N/A: Must be an administrator to view exclusions" and the HKLM Defender Exclusions key throws
SecurityException — so whether the runner work dir is excluded is an OPERATOR question, same class
as the tailnet ACL in [[windows-runner-firewall-drops-cold-inbound-to-rule-less-test-exes]]. A
Defender exclusion is a real security-posture change on the operator's own machine: propose it,
never apply it, and note it does not explain a red on its own (a1's Phase B was green under the
same Defender).
