rescript-lang / rescript-lang.org

Official documentation website for the ReScript programming language
https://rescript-lang.org
MIT License
1.85k stars 248 forks source link

Separate the Reason parser from the JS compiler bundle #263

Closed ryyppy closed 5 months ago

ryyppy commented 3 years ago

Due to the way the Reason v3.6 was designed, the resulting JS code of just the parser alone is twice the size of the whole ReScript compiler + syntax. Since users like @bobzhang are oftentimes in slow latency networks, shaping off more than half of the bundle size would heavily decrease load times.

Here is a perf benchmark made by Bob: image

Since Reason is pretty much stuck on v3.6, it would probably be a good idea to compile the Reason bundle separately, and plug the compiler + syntax back together on the frontend after lazily loading the Reason parser.

Steps to make this work:

Steps in the ReScript JSOO bundle:

This will greatly reduce the complexity in the ReScript compiler repo, and make the playground loading experience way more performant.

fhammerschmidt commented 5 months ago

This is basically solved. refmt is not part of the jsoo bundle since a long time and the Reason parser as part of the compiler only gets loaded when legacy versions like ReScript 9 or earlier are selected.