Performance Lab/ Experiment #002
TypeScript 6 vs 7 on type-fest
How much faster does TypeScript 7 type-check a real, type-heavy library than TypeScript 6, and how much of the gain comes from the native compiler itself rather than parallel checking? What happens to memory on a heavy workload?
Verdict
On an Apple M3 Pro (12 cores), TypeScript 7.0.2 checked the type-fest sources 3.5× faster than TypeScript 6.0.3 (0.484 s vs 1.67 s): 2.6× comes from the native compiler alone (single-threaded) and 1.3× from parallel checking. On the full suite with type tests, TypeScript 6 stops at Node.js's default heap limit (4.0 GiB); with a 16 GiB heap it finishes in 74.6 s, against 14.1 s for TypeScript 7 (5.3× faster), but TypeScript 7 peaks higher in memory (11.6 GiB RSS vs 10.4 GiB). Stays open until a second machine is measured with the same protocol.
Takeaway
Most of the gain is the native compiler, so expect it even on CI runners with few cores; more checkers help less (0.642 s with 1 checker, 0.377 s with 8). On large type-test suites, check peak memory before switching: TypeScript 7 needed no heap flag but used more memory at its peak.
Note Types and Instantiations differ between TypeScript 6 and 7 on identical code, so never compare these counters across compilers. TypeScript 7's counters also vary slightly from run to run on the full suite, single-threaded included; on the library sources they are identical across runs.
Note Memory is peak resident memory (RSS) from /usr/bin/time -l, field "maximum resident set size", of the largest process: the Node.js process for TypeScript 6, the native compiler for TypeScript 7 (its launcher replaces itself with the native binary). It is not the compiler's own "Memory used" line, which for TypeScript 6 is the V8 heap.
Note Out of memory means Node.js's default heap limit (4.0 GiB here), not the machine's RAM: TypeScript 6 aborted with "Reached heap limit" at 4.2 GiB RSS, and completed with --max-old-space-size=16384.
Note One library (type-fest at one commit), check time only: no emit, watch mode or editor latency.
Note The two machines differ by CPU as well as core count, so compare conditions within a machine; the comparison between machines is indicative only. On the 1-core Intel Xeon, parallel checking gives 1.0× (0.9× to 1.1×) and the native compiler 4.0×.
Note The Intel Xeon results use the earlier protocol: 3 runs, no warm-up, not interleaved, no RSS. The Apple M3 Pro results use a discarded warm-up per condition and interleaved runs, with other applications open (load average 3.0 to 5.0). The full-suite runs stay noisy: up to 6.7% coefficient of variation.
Note Checker counts were measured in a separate series from the default and single-threaded runs; compare them with each other.
Median check time
Results on Apple M3 Pro
Nov 11, 2026, 8 runs per condition at most, one discarded warm-up each, conditions interleaved. Apple M3 Pro, 12 cores, 36 GB, Node.js 22.23.3, Darwin 25.2.0.
| Condition | Check | Total | Peak RSS | Types | Instantiations |
|---|---|---|---|---|---|
| Sources, TypeScript 6.0.3 | 1.67 s | 1.87 s | 557 MiB | 234,740 | 707,312 |
| Sources, TypeScript 7.0.2 | 484 ms | 510 ms | 367 MiB | 276,225 | 839,577 |
| Sources, TypeScript 7.0.2 single-threaded | 636 ms | 675 ms | 338 MiB | 259,464 | 815,224 |
| Sources, TypeScript 7.0.2 with 1 checker | 642 ms | 667 ms | 355 MiB | 259,464 | 815,224 |
| Sources, TypeScript 7.0.2 with 2 checkers | 518 ms | 547 ms | 369 MiB | 266,340 | 825,383 |
| Sources, TypeScript 7.0.2 with 4 checkers | 475 ms | 501 ms | 376 MiB | 276,225 | 839,577 |
| Sources, TypeScript 7.0.2 with 8 checkers | 377 ms | 403 ms | 367 MiB | 288,128 | 856,115 |
| Full suite with type tests, TypeScript 6.0.3 | Out of memory at Node.js's default heap limit (4.0 GiB) | ||||
| Full suite with type tests, TypeScript 7.0.2 | 14.10 s | 14.17 s | 11.6 GiB | 15,320,722.5 | 38,893,721 |
| Full suite with type tests, TypeScript 6.0.3, 16 GB heap | 74.56 s | 75.13 s | 10.4 GiB | 8,872,839 | 36,421,290 |
| Full suite with type tests, TypeScript 7.0.2 single-threaded | 23.02 s | 23.33 s | 9.6 GiB | 8,535,794 | 34,156,859 |
Results on Intel Xeon Processor @ 2.30GHz
Nov 3, 2026, 3 runs per condition. Intel(R) Xeon(R) Processor @ 2.30GHz, 1 core, 4 GB, Node.js 22.22.2, Linux 6.18.44-fc-v230.
| Condition | Check | Total | Peak RSS | Types | Instantiations |
|---|---|---|---|---|---|
| Sources, TypeScript 6.0.3 | 6.68 s | 7.67 s | n/a | 234,740 | 707,312 |
| Sources, TypeScript 7.0.2 | 1.61 s | 1.71 s | n/a | 276,225 | 839,577 |
| Sources, TypeScript 7.0.2 single-threaded | 1.67 s | 1.76 s | n/a | 259,464 | 815,224 |
| Full suite with type tests, TypeScript 6.0.3 | Out of memory (cause not recorded) | ||||
| Full suite with type tests, TypeScript 7.0.2 | Out of memory (cause not recorded) | ||||
Reproduce it
Node.js 22 or later and git. Target: type-fest at commit 2fbae25.
npm install && npm run lab:002