Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Real-world ReScript vs TypeScript build performance: Complete dinero.js core rewrite

$
0
0

ReScript vs TypeScript Build Performance: A Real-World Benchmark

I rewrote dinero.js’ core package in ReScript to benchmark build times against TypeScript. Here are the results:

Environment

  • OS: Linux 6.11.0-1018-azure (GitHub Actions)

  • CPU: 4 cores, Memory: 15Gi

  • ReScript: 12.0.1, TypeScript: 5.9.3

  • Node.js: v24.12.0

Results

Clean Builds:

  • ReScript: 0.502s avg (10 trials, 68 modules)

  • TypeScript: 1.273s avg (10 trials, 74 files)

Incremental Builds:

  • ReScript: 0.205s avg (10 trials, 3 modules)

  • TypeScript: 1.236s avg (10 trials)

Performance Summary:

  • Clean Build Winner: ReScript (0.771s faster, 2.5x faster)

  • Incremental Build Winner: ReScript (1.031s faster, 6.0x faster)

  • 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.


Viewing all articles
Browse latest Browse all 2592

Trending Articles