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
5 changes: 4 additions & 1 deletion bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,10 @@ It sweeps fronts, names read per route, and route count, with `stable` names
route), each read by info lookup, fetch, or subscription and then closed. Once a
manual clock ages out every cache, asynchronous major collections from Chromium's
exposed `gc` run without stack heap pointers, so dead stack slots cannot pin a route
even under tracing. Weak references count the retired routes' sessions, transports,
even under tracing. Chromium compiles on the main thread here
(`--no-concurrent-recompilation`): a queued background optimization job holds its
closure's context strongly, so a cold run would otherwise keep a route a hot closure
captured until the job landed. Weak references count the retired routes' sessions, transports,
broadcast handles, and delivered payload buffers still reachable. These counts are exact,
so any nonzero one in a timed or traced pass fails the run once every sample is
written, leaving a retaining `before` revision's counts in the JSON. A concluded control must release everything,
Expand Down
12 changes: 11 additions & 1 deletion bench/browser/micro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,17 @@ const browser = await chromium.launch({
headless: true,
executablePath: process.env.BROWSER_BIN,
// Retention is counted after full collections the page asks for, against an unrounded heap size.
args: benchmark === "resume-history" ? ["--js-flags=--expose-gc", "--enable-precise-memory-info"] : [],
// Optimizing compiles stay on the main thread: a queued background job holds its closure's
// context strongly, so a route a hot closure captured stays reachable until the job lands.
// The delay only slows background jobs, so it is inert here, but it fails every cold run
// rather than an occasional one if compiles ever go concurrent again.
args:
benchmark === "resume-history"
? [
"--js-flags=--expose-gc --no-concurrent-recompilation --concurrent-recompilation-delay=300",
"--enable-precise-memory-info",
]
: [],
});
const samples: { round: number; variant: string; rows: string[] }[] = [];
const traced: { variant: string; rows: string[] }[] = [];
Expand Down
5 changes: 3 additions & 2 deletions js/net/bench/resume-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
*
* Counts come from weak references after full collections, so they are exact only under a precise
* collector: run it in Chromium with `bench/browser/micro.ts --bench resume-history`, which
* exposes `gc` and fails once a retired route stays reachable. Bun scans its stack conservatively,
* so a dead reference there can survive a collection.
* exposes `gc`, compiles on the main thread so no queued optimization job pins a closure's context,
* and fails once a retired route stays reachable. Bun scans its stack conservatively, so a dead
* reference there can survive a collection.
*/
import { Duration } from "@moq/clock";
import { Manual } from "@moq/clock/test";
Expand Down
28 changes: 0 additions & 28 deletions quest/m0/nightly/resume-history-control.md

This file was deleted.