Skip to content

Benchmarks

tsgo-strict does the same job as the original typescript-strict-plugin: flip "strict": true on an opted-in subset of files, type-check them, and filter the rest. The difference is the engine underneath — tsgo-strict drives the native TypeScript compiler shipped in TypeScript 7+ (the typescript package, formerly the tsgo native preview) from a Rust coordinator, while typescript-strict-plugin shells out to the older JavaScript tsc.

Methodology

Hardware: Linux dev container. perf-demo/ has 4,001 TS files across 20 batches, generated by perf-demo/scripts/generate.mjs. 5 warm runs each (1 warmup discarded), medians reported. Both CLIs run with cwd=perf-demo so node_modules (and @types/node) resolve identically.

  • tsgo-strict: target/release/tsgo-strict --project tsconfig.json
  • tsc-strict: node_modules/.bin/tsc-strict -p tsconfig.json (from typescript-strict-plugin 2.4.4, typescript 5.6.3)

Wall-clock (median of 5 runs)

Scenariotsc-strict (ms)tsgo-strict (ms)Speedup
Full project6,540852~7.7×
~7.7×
end-to-end speedup vs tsc-strict on full-project runs
<1 ms
tsconfig parsing (vs ~100 ms of Node startup + tsc --showConfig)
~205 ms
parallel pragma scan across 4,001 files via rayon

Where tsgo-strict's time goes

Phase timings collected via the programmatic API (timings[] on the result), median of 5 warm runs:

Phasetsgo-strict (ms)
config-load~0
file-resolution205
strict-run (tsgo compile)587

The wall-clock is dominated by strict-run — the actual type-check done by tsgo — and file-resolution, which reads the first 4 KB of each of the 4,001 files in parallel to scan for // @ts-strict / // @ts-strict-ignore pragmas. config-load rounds to zero.

Why the gap is this large

Most of the 7–8× comes from the compiler, not from Rust:

  • JavaScript tsc → native compiler. The native TypeScript 7 compiler is the bulk of the win. It does the same type-check as the older JavaScript tsc but in native code with parallel work, so the compile step is several times faster on the same project.
  • Config load is free. tsgo-strict parses tsconfig.json (plus its extends chain) in Rust in well under a millisecond. tsc-strict first shells out to tsc --showConfig just to read the plugin block, which costs ~100 ms of Node startup before it does any real work.
  • Pragma scanning goes parallel. Deciding which files are "strict" requires reading the head of each file to look for pragmas. tsgo-strict does this across cores with rayon; tsc-strict post-processes tsc --listFiles output serially in Node.

Reproduce these locally

The perf-demo/ workspace generates a synthetic 4,001-file project:

bash
pnpm perf:generate                                    # materializes perf-demo/src/
(cd perf-demo && npm install --no-save typescript typescript-strict-plugin @types/node)
bash scripts/bench-vs-tsc-strict.sh                   # runs both CLIs, prints a median table

Numbers will vary with your hardware, but the shape — tsgo-strict finishing under a second on 4,000 files while tsc-strict spends several seconds in tsc — is stable.

Released under the Apache License 2.0.