Public: anyone can read this; the crew can change it.
The check's tsc gets a 6 GiB heap bound: under 2 GiB its collector never stopped, and tsc was a check's largest CPU cost #17285
Merged 40h 1m ago, live in production
perf/tsc-memlimit → main 0 commits
4 files
changed +15
−9
docs/DEVELOP.md +7 −3
| @@ -82,12 +82,16 @@ fails a check: `bun scripts/gate.ts --fix` rewraps every comment line over | ||
| 82 | 82 | `--all` for the whole tree) and then runs the same audit. A pull that skips |
| 83 | 83 | it gets one `gate: note:` line in its check log and lands as it is; the |
| 84 | 84 | nightly `rewrap` job (docs/features/nightly.md) proposes the files main |
| 85 | changed in the last two days, rewrapped, as one pull. `tsc` then runs `--incremental` with a 2 GB heap, | |
| 85 | changed in the last two days, rewrapped, as one pull. `tsc` then runs `--incremental` with a 6 GB heap bound, | |
| 86 | 86 | its build info in `.forge-cache/` (made first with `mkdir -p`: tsc will not |
| 87 | 87 | create the directory, and a checkout with no restored cache failed on it, |
| 88 | 88 | #1881). It is TypeScript 7, the native compiler (a |
| 89 | Go binary, so the bound is `GOMEMLIMIT=2GiB`): on this tree a cold check is | |
| 90 | ~3 s and ~17 CPU-s where 5.9 took ~30 s and ~50 CPU-s (#1864). 5.9 stays as | |
| 89 | Go binary, so the bound is `GOMEMLIMIT=6GiB`, above its working set of about | |
| 90 | 3.5 GB and inside the check's 8 GiB): on this tree a cold check is ~8 s and | |
| 91 | ~30 CPU-s, a warm one ~1.6 s and ~7 CPU-s (#1864). The bound was 2 GiB until | |
| 92 | the tree outgrew it; under the working set the collector never stops, and the | |
| 93 | same cold check cost ~66 CPU-s (~218 with one checker) on a Mac and ~450 on | |
| 94 | the check runners. 5.9 stays as | |
| 91 | 95 | the dev dependency `typescript-api` only because `scripts/hollow.ts` walks |
| 92 | 96 | its AST, which 7.0 has no stable JS API for. The forge restores |
| 93 | 97 | `.forge-cache/` from the base's own green check and keeps it only from green checks of the default |
forge.json +3 −3
| @@ -41,9 +41,9 @@ | ||
| 41 | 41 | } |
| 42 | 42 | }, |
| 43 | 43 | "check": { |
| 44 | "fast": "bun scripts/gate.ts && bun scripts/design-drift.ts && mkdir -p .forge-cache && GOMEMLIMIT=2GiB ./node_modules/typescript/bin/tsc --noEmit --incremental --tsBuildInfoFile .forge-cache/tsc.tsbuildinfo && bun scripts/test-shards.ts --timeout 60000 --tier fast --diff $FORGE_CHECK_BASE..HEAD --learned \"$FORGE_CHECK_LEARNED\"", | |
| 45 | "run": "bun scripts/gate.ts && bun scripts/design-drift.ts && mkdir -p .forge-cache && GOMEMLIMIT=2GiB ./node_modules/typescript/bin/tsc --noEmit --incremental --tsBuildInfoFile .forge-cache/tsc.tsbuildinfo", | |
| 46 | "full": "bun scripts/gate.ts && bun scripts/design-drift.ts && mkdir -p .forge-cache && GOMEMLIMIT=2GiB ./node_modules/typescript/bin/tsc --noEmit --incremental --tsBuildInfoFile .forge-cache/tsc.tsbuildinfo && bun test test/client-size.test.ts", | |
| 44 | "fast": "bun scripts/gate.ts && bun scripts/design-drift.ts && mkdir -p .forge-cache && GOMEMLIMIT=6GiB ./node_modules/typescript/bin/tsc --noEmit --incremental --tsBuildInfoFile .forge-cache/tsc.tsbuildinfo && bun scripts/test-shards.ts --timeout 60000 --tier fast --diff $FORGE_CHECK_BASE..HEAD --learned \"$FORGE_CHECK_LEARNED\"", | |
| 45 | "run": "bun scripts/gate.ts && bun scripts/design-drift.ts && mkdir -p .forge-cache && GOMEMLIMIT=6GiB ./node_modules/typescript/bin/tsc --noEmit --incremental --tsBuildInfoFile .forge-cache/tsc.tsbuildinfo", | |
| 46 | "full": "bun scripts/gate.ts && bun scripts/design-drift.ts && mkdir -p .forge-cache && GOMEMLIMIT=6GiB ./node_modules/typescript/bin/tsc --noEmit --incremental --tsBuildInfoFile .forge-cache/tsc.tsbuildinfo && bun test test/client-size.test.ts", | |
| 47 | 47 | "verify": "bun scripts/gate.ts && bun scripts/test-shards.ts --timeout 60000 --gate --impact --keep-going --nice", |
| 48 | 48 | "timeout": 7200, |
| 49 | 49 | "limits": { |
scripts/preflight.ts +1 −1
| @@ -213,7 +213,7 @@ async function main(): Promise<number> { | ||
| 213 | 213 | ); |
| 214 | 214 | const parts = await Promise.all([ |
| 215 | 215 | run("tsc", [BUN, "node_modules/typescript/bin/tsc", "--noEmit"], (o) => o.split("\n").filter((l) => /error TS\d+/.test(l)), { |
| 216 | GOMEMLIMIT: "2GiB", | |
| 216 | GOMEMLIMIT: "6GiB", | |
| 217 | 217 | }), |
| 218 | 218 | run("gate", [BUN, "scripts/gate.ts"], (o) => o.split("\n").filter((l) => l.startsWith("gate:"))), |
| 219 | 219 | ...batches.map((b, i) => run(`tests ${i + 1}/${batches.length}`, [BUN, "test", ...b.map((f) => `./${f}`)], failures)), |
test/shards.test.ts +4 −2
| @@ -636,8 +636,10 @@ describe("the gate audit alone, first in the check", () => { | ||
| 636 | 636 | if (!check.ok || check.value === undefined) throw new Error("no check"); |
| 637 | 637 | for (const command of [check.value.run, check.value.fast ?? ""]) { |
| 638 | 638 | expect(command.startsWith("bun scripts/gate.ts && ")).toBe(true); |
| 639 | // TypeScript 7 (#1864): a Go binary, so its heap bound is GOMEMLIMIT, not node's. | |
| 640 | expect(command).toContain(" && GOMEMLIMIT=2GiB ./node_modules/typescript/bin/tsc --noEmit "); | |
| 639 | // TypeScript 7 (#1864): a Go binary, so its heap bound is GOMEMLIMIT, not node's. Above its | |
| 640 | // working set (about 3.5 GB on this tree): under it the collector runs without pause and a cold | |
| 641 | // check costs 2 to 12 times the CPU. | |
| 642 | expect(command).toContain(" && GOMEMLIMIT=6GiB ./node_modules/typescript/bin/tsc --noEmit "); | |
| 641 | 643 | expect(command.indexOf("scripts/gate.ts")).toBeLessThan(command.indexOf("bin/tsc")); |
| 642 | 644 | // tsc will not create its build-info directory (#1881): a checkout with no restored cache failed TS5033. |
| 643 | 645 | expect(command).toContain(`mkdir -p ${CHECK_CACHE} && `); |
new above
offline