From 63e8630fcb5cebe55e65b8870ae3c5781d1282ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 22 Oct 2026 06:41:15 +0200 Subject: [PATCH] perf(bench): profile a production boot and the idle heap scripts/bench/boot-profile.ts starts the production build with every role under the production heap ceiling against the seeded benchmark database, and records the time to a healthy probe and to a ready worker, every event-loop stall the process logs, the heap lines, the full collections from --trace-gc, the main thread's busy stretches during the boot with their self time by source module (resolved through the chunk source maps), and one heap snapshot after an idle wait, summarised by node type, constructor, largest strings and largest retained subtrees. The baseline on the current runtime: a 753 ms busy stretch at 0.7 s, most of it the worker graph, and a live heap of 164 to 172 MB after five idle minutes, of which the query compiler holds about 50 MB and the eight locale catalogs about 33 MB (32 parsed copies and two 9.7 MB chunk sources). --- scripts/bench/boot-profile.ts | 398 +++++ scripts/bench/profile-analyze.ts | 599 ++++++++ .../bench/results/v1.45.0-before-boot.json | 1351 +++++++++++++++++ scripts/bench/results/v1.45.0-before-boot.md | 221 +++ 4 files changed, 2569 insertions(+) create mode 100644 scripts/bench/boot-profile.ts create mode 100644 scripts/bench/profile-analyze.ts create mode 100644 scripts/bench/results/v1.45.0-before-boot.json create mode 100644 scripts/bench/results/v1.45.0-before-boot.md diff --git a/scripts/bench/boot-profile.ts b/scripts/bench/boot-profile.ts new file mode 100644 index 000000000..e2e499bfe --- /dev/null +++ b/scripts/bench/boot-profile.ts @@ -0,0 +1,398 @@ +/** + * Boot and idle-memory profile of the production build. + * + * DATABASE_URL=postgresql://… API_TOKEN_HMAC_KEY=… ENCRYPTION_KEYS=… \ + * ENCRYPTION_ACTIVE_KEY_ID=… pnpm dlx tsx scripts/bench/boot-profile.ts \ + * [--idle-seconds 300] [--heap-mb 792] [--port 3101] \ + * [--no-snapshot] [--no-cpu-prof] [--out scripts/bench/results/