Benchmarks

Compiler performance by benchmark category: tsz vs TSGO

Benchmarks are run using hyperfine with warmup passes and multiple runs. Each benchmark measures wall-clock time for a full type-check pass (no emit).

tsz is compiled with --profile dist (LTO enabled, single codegen unit). tsgo is the native Go compiler from the TypeScript team.

tsz (Rust compiler) TSGO (Go compiler)

Category Breakdown

General Benchmarks

Core compiler behavior on representative mixed workloads.

manyConstExports.ts
5,003 lines, 150 KB
tsz
91ms
TSGO
308ms tsz 3.4x faster
enumLiteralsSubtypeReduction.ts
2,055 lines, 39 KB
tsz
135ms
TSGO
318ms tsz 2.4x faster
BCT candidates=50
128 lines, 9 KB
tsz
80ms
TSGO
295ms tsz 3.7x faster
Constraint conflicts N=30
139 lines, 13 KB
tsz
70ms
TSGO
293ms tsz 4.2x faster
Mapped complex template keys=50
102 lines, 3 KB
tsz
76ms
TSGO
292ms tsz 3.8x faster

Synthetic Type Workloads

Generated stress tests that isolate specific type-system patterns.

100 classes
4,603 lines, 81 KB
tsz
145ms
TSGO
304ms tsz 2.1x faster
50 generic functions
1,161 lines, 36 KB
tsz
127ms
TSGO
305ms tsz 2.4x faster
DeepPartial optional chain N=50
2,074 lines, 514 KB
tsz
402ms
TSGO
423ms tsz 1.1x faster
Shallow optional chain N=50
2,070 lines, 514 KB
tsz
377ms
TSGO
425ms tsz 1.1x faster

Solver Stress Tests

Upper-bound tests for recursive, mapped, and conditional type complexity.

Recursive generic depth=25
44 lines, 1 KB
tsz
73ms
TSGO
290ms tsz 4.0x faster
Conditional dist N=50
82 lines, 1 KB
tsz
71ms
TSGO
290ms tsz 4.1x faster
Mapped type keys=100
131 lines, 2 KB
tsz
74ms
TSGO
294ms tsz 4.0x faster

External Libraries: ts-toolbelt

Real-world ts-toolbelt files with heavy type-level programming patterns.

Iteration/Iteration.ts
215 lines, 8 KB
tsz
75ms
TSGO
304ms tsz 4.1x faster

External Libraries: ts-essentials

Real-world ts-essentials files from the pinned upstream snapshot.

paths.ts
101 lines, 3 KB
tsz
53ms
TSGO
64ms tsz 1.2x faster

How to Read These Charts

Each category is normalized independently for readability: bar lengths are scaled to the slowest benchmark within that category.

Running Benchmarks Locally

To generate benchmark data yourself:

./scripts/bench/bench-vs-tsgo.sh --json

This produces a JSON file in artifacts/ that the website build script uses to generate charts. Use --quick for faster results with fewer iterations.

See bench-vs-tsgo.sh for full usage.