hex/perf/launch.bench.ts
Luke Parker 9f52e8dafd
perf: run tray, hidden-launch, and listening benches on a locked session (#1205)
Tray targets use strobe's windowless native target; a hidden launch ends on the local API's start line; listening cases with released and open microphone profiles.
2026-11-03 15:21:32 -06:00

36 lines
1.1 KiB
TypeScript

// Launches (docs/perf.md): process start, fonts, GPU device and pipelines,
// and the first frames.
import { bench, native } from "@hona/strobe"
const api = { match: "local API started" }
export default bench({
targets: {
// Needs an unlocked session: it ends on the window's first painted frame.
window: native("hex", { bridge: false }),
// A login launch with no window. Runs on a locked session too.
tray: native("hex", { args: ["--hidden"], window: false, bridge: false }),
},
cases: {
"cold-launch": {
targets: ["window"],
primary: "launch.ready",
metrics: ["launch.settled", "launch.api", "cpu.work", "memory.app.private"],
launch: {
until: { window: "painted" },
// The local API starts on its own thread while the window opens.
milestones: { api },
},
},
// To the local API answering: the runtime, tray, and overlays are up.
"hidden-launch": {
targets: ["tray"],
primary: "launch.ready",
metrics: ["cpu.work", "memory.app.private"],
launch: {
until: { milestone: "api" },
milestones: { api },
},
},
},
})