ReScript vs TypeScript Performance 2025: Clean Build Benchmark Shows TypeScript 3x Faster on Large Codebases

Hi Everyone,

I’d like to share my findings for clean builds of large ReScript vs large TypeScript codebases. TL;DR: Clean builds of ReScript codebases appear to be slower than clean builds of TypeScript codebases, and the performance gap widens with codebase size.

My methodology:

  • Generated similar dependency graphs for both codebases, with approximately 12% of modules importing from a base module/package

  • Generated 1000, 2000, and 5000 ReScript/TypeScript files across 10 modules/packages, then performed clean builds

  • Ran three trials per test configuration, averaged the results, and aggregated them into the following findings:

  • 1000 modules / 10 packages: TypeScript 2.42s · ReScript 4.27s · TypeScript 1.77× faster

  • 2000 modules / 10 packages: TypeScript 3.36s · ReScript 7.97s · TypeScript 2.37× faster

  • 5000 modules / 10 packages: TypeScript 6.73s · ReScript 20.24s · TypeScript 3.01× faster

The codebase used to run these trials can be found here: GitHub - nathan-tranquilla/rescript-benchmarks

The setup is straightforward and should be simple to reproduce, so please scrutinize the approach if there’s something incorrect about it.

While incremental builds for ReScript do outperform TypeScript (though I have yet to run formal tests on this), clean builds remain very important for CI environments.

This result was not what I expected. While I hope to promote ReScript, this does seem to be an area where TypeScript still remains dominant.

I’m happy to run additional experiments.

5 Likes

I think the important metric is incremental builds, as that directly impacts developer performance. It makes some sense to me that clean builds take longer, as that is the point of a strong type-system; to front-load the effort of determining if operations are safe.

When I saw this at first I assumed it must be using the new TS Go compiler, though I’m not even sure that’s available yet. But nope, it’s TS 5.9!

Is it possible that TS is so fast here because the generated code is fairly simplistic compared to a real world codebase?

I ran that thought by Claude:

The generated TypeScript modules use type aliases (type T = string) with explicit return types, which requires almost no type inference or analysis from the compiler.

1 Like

I am afraid this benchmark does not really reflect real world scenarios. ReScript creates a lot of intermediary files for every .res file. There are ideas around this like putting more of that into a in-memory database, as most codebases would fit entirely into the RAM of modern machines, but at least a rescript build performs much better than a rescript-legacy build.

I am not sure how TypeScript handles it internally, but I think it creates fewer files and thus there is less I/O.

If there were more type definitions, possibly interdependent ones, this benchmark would be more interesting.

4 Likes

Thanks for doing this btw! Much appreciated!

3 Likes