Performance LabLab #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?

Status
OpenWaiting for a second machine measured with the same protocol.
Published
Last updated
On this page

Abstract

How much faster does TypeScript 7 type-check a real, type-heavy library than TypeScript 6, how much of the gain comes from the native compiler rather than parallel checking, and what happens to memory? type-fest was checked at a pinned commit with TypeScript 6.0.3 and 7.0.2 on an Apple M3 Pro, with a discarded warm-up per condition and interleaved runs. TypeScript 7 checked the library sources 3.5× faster (2.6× from the native compiler alone, 1.3× from parallel checking) and the full suite with type tests 5.3× faster, while peaking higher in memory (11.6 GiB against 10.4 GiB). The main limit: one library, and only one machine measured with this protocol so far, with other applications open.

Key numbers

3.5×

faster check of the library sources, TypeScript 7 vs 6

ratio of median check times
Apple M3 Pro,

2.6×

faster from the native compiler alone, TypeScript 7 single-threaded vs 6

ratio of median check times
Apple M3 Pro,

5.3×

faster on the full suite with type tests

ratio of median check times
Apple M3 Pro,

11.6 GiBvs 10.4 GiB

peak memory on the full suite, TypeScript 7 vs TypeScript 6

median peak RSS
Apple M3 Pro,

1Introduction

TypeScript 7 is a native port of the compiler. Teams planning the move want to know what it changes for their own checks: how much faster CI gets, whether the gain needs a machine with many cores, and whether memory goes up or down.

type-fest is a demanding test for those questions: a widely used library made almost entirely of complex types, with a suite of type tests that is much heavier than the library itself. Measuring both workloads separates the everyday case from the stress case.

2Method

Subject

type-fest at a pinned commit, in two workloads: the library sources only (index.d.ts and source/), and the full suite including the type tests (test-d/). TypeScript 7 is also run with --singleThreaded, to separate the native compiler from parallel checking, and with --checkers set to several values in a separate series. The full suite is checked with TypeScript 6 twice: with Node.js's default heap, run once to record the error, and with a larger heap.

Target: type-fest at commit 2fbae25. Each run is tsc -p <project> --extendedDiagnostics.

Environment and protocol, per machine

Apple M3 Pro, 12 coresMeasured

CPU
Apple M3 Pro
Cores
12
RAM
36 GB
OS
Darwin 25.2.0
Node.js
22.23.3
Compilers
TypeScript 6.0.3, TypeScript 7.0.2
Protocol
Runs per condition
5 to 8, per condition below
Warm-up
1 per condition, discarded, in every series except where noted below
Order
Interleaved (A B C A B C)
Cooldown
120 s idle before each series
Power
AC power, Low Power Mode off
Series, in the order they ran
SeriesWarm-upInterleavedLoad before1-minute averageLoad after1-minute average
sources1, discardedyes5.004.18
checkers1, discardedyes4.182.95
full-ts6-default-heapnoneyes2.953.61
full1, discardedyes3.614.94
full-extra1, discardedyes3.493.75
Conditions
  • Sources, TypeScript 6.0.3, 7 runs
  • Sources, TypeScript 7.0.2, 7 runs
  • Sources, TypeScript 7.0.2 single-threaded, --singleThreaded, 7 runs
  • Sources, TypeScript 7.0.2 with 1 checker, --checkers 1, 5 runs
  • Sources, TypeScript 7.0.2 with 2 checkers, --checkers 2, 5 runs
  • Sources, TypeScript 7.0.2 with 4 checkers, --checkers 4, 5 runs
  • Sources, TypeScript 7.0.2 with 8 checkers, --checkers 8, 5 runs
  • 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, 8 runs
  • Full suite with type tests, TypeScript 6.0.3, 16 GB heap, NODE_OPTIONS=--max-old-space-size=16384, 8 runs
  • Full suite with type tests, TypeScript 7.0.2 single-threaded, --singleThreaded, 8 runs

Intel Xeon, 1 coreMeasured

CPU
Intel Xeon Processor @ 2.30GHz
Cores
1
RAM
4 GB
OS
Linux 6.18.44-fc-v230
Node.js
22.22.2
Compilers
TypeScript 6.0.3, TypeScript 7.0.2
Protocol
Runs per condition
3
Warm-up
None
Order
In sequence (A A A B B B)
Cooldown
Not recorded
Conditions
  • Sources, TypeScript 6.0.3, 3 runs
  • Sources, TypeScript 7.0.2, 3 runs
  • Sources, TypeScript 7.0.2 single-threaded, --singleThreaded, 3 runs
  • 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)

Metrics

Check time
The "Check time" line printed by tsc --extendedDiagnostics, in seconds: the time spent in the type checker only.
Total time
The "Total time" line printed by tsc --extendedDiagnostics, in seconds: parsing, binding and checking together.
Median
The middle value of the measured runs, or the mean of the two middle values for an even count. Every reported figure is a median.
Range
The fastest and slowest measured runs, shown as whiskers on the charts.
IQR
Interquartile range, Q3 minus Q1, with quartiles by linear interpolation between order statistics.
CV
Coefficient of variation: sample standard deviation divided by the mean. Above 5%, the cause is investigated and logged.
Peak memory
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.
Gain
Ratio of two median check times. The native part compares TypeScript 6 with TypeScript 7 single-threaded; the parallel part compares single-threaded with the default mode. Their product is the total gain.

The full protocol is on the method page.

3Results

Apple M3 Pro, 12 coresWarm-up discarded, interleaved,

Median check time, library sources, Apple M3 Pro, Nov 11, 2026

Bar: median. Whisker: fastest to slowest run.

Data table
ConditionRunsMedianMinMaxIQRCV
TypeScript 6.0.371.67 s1.66 s1.70 s0.010 s0.8%
TypeScript 7.0.270.484 s0.473 s0.492 s0.007 s1.3%
TypeScript 7.0.2 single-threaded70.636 s0.623 s0.639 s0.004 s0.9%
Median check time, TypeScript 7 checker count, separate series, Apple M3 Pro, Nov 11, 2026

Bar: median. Whisker: fastest to slowest run.

Data table
ConditionRunsMedianMinMaxIQRCV
TypeScript 7.0.2 with 1 checker50.642 s0.623 s0.668 s0.014 s2.6%
TypeScript 7.0.2 with 2 checkers50.518 s0.508 s0.529 s0.012 s1.7%
TypeScript 7.0.2 with 4 checkers50.475 s0.464 s0.493 s0.010 s2.3%
TypeScript 7.0.2 with 8 checkers50.377 s0.365 s0.387 s0.007 s2.2%
Median check time, full suite with type tests, Apple M3 Pro, Nov 11, 2026

Bar: median. Whisker: fastest to slowest run.

Data table
ConditionRunsMedianMinMaxIQRCV
TypeScript 6.0.3Out of memory at Node.js's default heap limit (4.0 GiB)
TypeScript 7.0.2814.1 s13.0 s15.8 s0.627 s6.7%
TypeScript 6.0.3, 16 GB heap874.6 s69.9 s82.6 s5.32 s5.5%
TypeScript 7.0.2 single-threaded823.0 s21.6 s24.9 s2.14 s5.6%
Median peak memory (RSS), full suite with type tests, Apple M3 Pro, Nov 11, 2026

Bar: median. Whisker: fastest to slowest run.

Data table
ConditionRunsMedianMinMaxIQRCV
TypeScript 7.0.2811.6 GiB11.2 GiB12.3 GiB0.1 GiB2.5%
TypeScript 6.0.3, 16 GB heap810.4 GiB9.8 GiB10.8 GiB0.6 GiB3.5%
TypeScript 7.0.2 single-threaded89.6 GiB8.8 GiB9.9 GiB0.9 GiB5.1%
Where the gain on the sources comes from, Apple M3 Pro
FactorRatio of mediansConservative range
Native compilerTypeScript 6 / TypeScript 7 single-threaded2.6×2.60 to 2.73
Parallel checkingTypeScript 7 single-threaded / default1.3×1.27 to 1.35
TotalTypeScript 6 / TypeScript 7 default3.5×3.37 to 3.59

Native × parallel = 3.450, total = 3.450. Range: fastest run of one condition over slowest of the other, both ways.

Check time per condition, Apple M3 Pro, 12 cores
ConditionRunsMedianMinMaxIQRCVTotal timemedianPeak RSSmedian
Sources, TypeScript 6.0.371.67 s1.66 s1.70 s0.010 s0.8%1.87 s557 MiB
Sources, TypeScript 7.0.270.484 s0.473 s0.492 s0.007 s1.3%0.510 s367 MiB
Sources, TypeScript 7.0.2 single-threaded70.636 s0.623 s0.639 s0.004 s0.9%0.675 s338 MiB
Sources, TypeScript 7.0.2 with 1 checker50.642 s0.623 s0.668 s0.014 s2.6%0.667 s355 MiB
Sources, TypeScript 7.0.2 with 2 checkers50.518 s0.508 s0.529 s0.012 s1.7%0.547 s369 MiB
Sources, TypeScript 7.0.2 with 4 checkers50.475 s0.464 s0.493 s0.010 s2.3%0.501 s376 MiB
Sources, TypeScript 7.0.2 with 8 checkers50.377 s0.365 s0.387 s0.007 s2.2%0.403 s367 MiB
Full suite with type tests, TypeScript 6.0.3Out of memory at Node.js's default heap limit (4.0 GiB), peak RSS 4.2 GiB
Full suite with type tests, TypeScript 7.0.2814.1 s13.0 s15.8 s0.627 s6.7%14.2 s11.6 GiB
Full suite with type tests, TypeScript 6.0.3, 16 GB heap874.6 s69.9 s82.6 s5.32 s5.5%75.1 s10.4 GiB
Full suite with type tests, TypeScript 7.0.2 single-threaded823.0 s21.6 s24.9 s2.14 s5.6%23.3 s9.6 GiB
Compiler counters and reported memory
ConditionMemory reportedby the compiler, medianInstantiationsTypesFiles
Sources, TypeScript 6.0.3440 MiB707,312234,740338
Sources, TypeScript 7.0.2265 MiB839,577276,225338
Sources, TypeScript 7.0.2 single-threaded249 MiB815,224259,464338
Sources, TypeScript 7.0.2 with 1 checker250 MiB815,224259,464338
Sources, TypeScript 7.0.2 with 2 checkers256 MiB825,383266,340338
Sources, TypeScript 7.0.2 with 4 checkers264 MiB839,577276,225338
Sources, TypeScript 7.0.2 with 8 checkers276 MiB856,115288,128338
Full suite with type tests, TypeScript 7.0.2counters vary across runs10.1 GiB38,893,72115,320,723653
Full suite with type tests, TypeScript 6.0.3, 16 GB heap10.5 GiB36,421,2908,872,839653
Full suite with type tests, TypeScript 7.0.2 single-threadedcounters vary across runs7.0 GiB34,156,8598,535,794653

Memory reported is the compiler's own "Memory used" line, a different metric for each compiler. Counters varied across runs for: Full suite with type tests, TypeScript 7.0.2; Full suite with type tests, TypeScript 7.0.2 single-threaded. They were identical across runs for every other condition.

Superseded on this machine: the session of Nov 9, 2026 (3 runs, no warm-up, not interleaved). Its raw file stays in results/ and is listed under Data.

Intel Xeon, 1 coreSecondary machine, own scales. Earlier protocol: no warm-up, in sequence,

Median check time, library sources, Intel Xeon, Nov 3, 2026

Bar: median. Whisker: fastest to slowest run.

Data table
ConditionRunsMedianMinMaxIQRCV
TypeScript 6.0.336.68 s6.53 s6.92 s0.195 s2.9%
TypeScript 7.0.231.61 s1.59 s1.70 s0.055 s3.6%
TypeScript 7.0.2 single-threaded31.67 s1.61 s1.80 s0.095 s5.7%

Full suite with type tests, Intel Xeon, Nov 3, 2026

  • TypeScript 6.0.3: Out of memory (cause not recorded)
  • TypeScript 7.0.2: Out of memory (cause not recorded)
Where the gain on the sources comes from, Intel Xeon
FactorRatio of mediansConservative range
Native compilerTypeScript 6 / TypeScript 7 single-threaded4.0×3.62 to 4.29
Parallel checkingTypeScript 7 single-threaded / default1.0×0.95 to 1.13
TotalTypeScript 6 / TypeScript 7 default4.1×3.83 to 4.34

Native × parallel = 4.144, total = 4.144. Range: fastest run of one condition over slowest of the other, both ways.

Check time per condition, Intel Xeon, 1 core
ConditionRunsMedianMinMaxIQRCVTotal timemedianPeak RSSmedian
Sources, TypeScript 6.0.336.68 s6.53 s6.92 s0.195 s2.9%7.67 sn/a
Sources, TypeScript 7.0.231.61 s1.59 s1.70 s0.055 s3.6%1.71 sn/a
Sources, TypeScript 7.0.2 single-threaded31.67 s1.61 s1.80 s0.095 s5.7%1.76 sn/a
Full suite with type tests, TypeScript 6.0.3Out of memory (cause not recorded)
Full suite with type tests, TypeScript 7.0.2Out of memory (cause not recorded)
Compiler counters and reported memory
ConditionMemory reportedby the compiler, medianInstantiationsTypesFiles
Sources, TypeScript 6.0.3353 MiB707,312234,740338
Sources, TypeScript 7.0.2264 MiB839,577276,225338
Sources, TypeScript 7.0.2 single-threaded249 MiB815,224259,464338

Memory reported is the compiler's own "Memory used" line, a different metric for each compiler. Counters were identical across runs of each condition.

4Discussion

Most of the speedup does not depend on cores. TypeScript 7 single-threaded is already 2.6× faster than TypeScript 6, and parallel checking adds 1.3× on top. On the one-core Intel Xeon, measured with the earlier protocol, the native compiler gives 4.0× and parallel checking 1.0×: small CI runners get most of the gain.

Memory is the surprise. On the full suite TypeScript 7 peaks higher than TypeScript 6 given a 16 GiB heap (11.6 GiB against 10.4 GiB), while TypeScript 7 single-threaded peaks at 9.6 GiB and takes 23 s. Parallel checking trades memory for time. TypeScript 6 cannot finish the full suite at all at Node.js's default heap limit (4.0 GiB).

The default mode does not use every core: --checkers 8 checked the sources 22% faster than the default mode, in a separate series.

Lab #001 measured the other lever: one costly type pattern, fixed, cut check time with TypeScript 7 as well as with TypeScript 6. Migrating does not remove the cost of a slow type, so the two gains add up.

5Limitations and threats to validity

  • 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.
  • 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.
  • 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.
  • One library (type-fest at one commit), check time only: no emit, watch mode or editor latency.
  • 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×.
  • 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.
  • The checker series was measured with other applications open (load average 3.0 to 4.2), and in a separate series from the default mode: the comparison between --checkers 8 and the default mode crosses two series.
  • Results come from one machine per session: compare conditions within the same machine only.

6Conclusion and recommendations

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.

Most of the gain comes from the native compiler, so expect it even on small CI runners. The default mode does not use all available cores: on this 12-core machine, --checkers 8 checked the sources in 0.377 s, 22% faster than the default mode (0.484 s), and --checkers 4 took 0.475 s.

Recommendations

  1. Expect most of the gain even on small CI runners: it comes from the native compiler, not from the number of cores.
  2. Before switching a heavy type-test suite, measure its peak memory with TypeScript 7 and size CI runners on it, not on check time alone.
  3. On machines with many cores, try --checkers: the default mode did not use all of them here.
  4. Measure your own codebase with the same protocol before deciding: one library is not your project.

7Reproduce

Node.js 22 or later and git. From the repository root, run the experiment, then recompute every statistic from the results files. New results land in experiments/002-ts6-vs-ts7-type-fest/results/: open a pull request with yours to add a machine.

npm install && npm run lab:002
node experiments/002-ts6-vs-ts7-type-fest/analyze.mjs

8Data

All raw files: results folder on GitHub. Everything shown on this page: data.json.

9Changelog

  1. First published at 4.0×; corrected to 3.5× after adding a warm-up run and interleaving.