Incremental Efficiency: ReScript 2.4x faster than its clean builds, TypeScript only 1.0x
Methodology
Project Selection: I chose Dinero.js because its core package has a medium-sized API (74 TypeScript files), making the rewrite manageable while being substantial enough for meaningful benchmarks.
Rewrite Process: The port resulted in 68 ReScript modules mirroring the TypeScript structure. I performed an AI-assisted conversion over several days, leveraging the comprehensive test suite for validation. With minor internal API adjustments, I kept all tests passing except 4.
Testing Strategy: I colocated ReScript output files with source files (avoiding lib/ folder) and retargeted Jest imports from TypeScript to ReScript output (JS files). This approach was both practical and safe given the extensive test coverage.
Version Choices: I upgraded TypeScript from the original 4.8.4 to 5.9.3 to ensure the fairest possible comparison against ReScript 12.0.1.
Conclusion
I think the claims of faster build times, both clean and incremental, are proven to be true for this medium sized real-life codebase.
I was a bit puzzled by the incremental build time in TypeScript being the same as the clean build. That didn’t make sense to me, so I did check out the repository locally and I verified that the incremental flag is not set anywhere, neither in the command line or in the tsconfig file.
After setting incremental to true in the tsconfig file, then the results do change. This is what I get in my laptop.
Generally speaking, now the TypeScript numbers make a little bit more sense given that the incremental is a bit shorter given we are touching only one file.
Regarding compile time comparisons between the two compilers, this is highly dependent on the code and there is one thing that Rescript will always win on, which is that the type system is simpler and will have more predictable compile times as code size grows.
TypeScript’s type system is so complicated and powerful that you are bound to include libraries that will skyrocket your compile times as the project grows. This is of course a lot harder to prove with benchmarks, especially when doing the project in both rescript and typescript, because they cannot express the same things with the same type safety. They are very different when you go to the advanced parts of them.
My interpretation, these are great results because they are in the same order of magnitude as the new TypeScript compiler which has been engineered from scratch with performance in mind and with lots of lessons learned from all the previous compiler versions.