4 ms·
I love languages, and I want to use languages with powerful, sound type systems on the web, but I don't want to do it at the cost of shipping much larger amount
by rictic 7y ago
I love languages, and I want to use languages with powerful, sound type systems on the web, but I don't want to do it at the cost of shipping much larger amounts of code, making for a slow initial render.
A vanilla JS todomvc app is 10KB of JS (plus some analytics code for some reason): http://todomvc.com/examples/vanilla-es6/ http://todomvc.com/examples/vanilla-es6/
The production build of the ReasonML todomvc app ships 5x as much, 56KB JS.
How much of that is a static runtime cost, and how much is just the cost of translating ReasonML into the corresponding JS? An extra 40KB isn't great, but it's not a dealbreaker. A shipping 4x-5x as much JS would be, in a lot of cases.
- chenglou 7y agoEh where did you see that? ReasonReact is runtime-free, unless you’re explicitly using some of the extra helpers.
- rictic 7y agoI ran the production build of https://github.com/reasonml-community/reason-react-example/tree/master/src/todomvc https://github.com/reasonml-community/reason-react-example/t... and ran the JS bundle through gzip -9 to get the 56KB number.
- chenglou 7y agoOh man, that repo's stale. The official instructions are here: https://reasonml.github.io/reason-react/docs/en/installation https://reasonml.github.io/reason-react/docs/en/installation
- yawaramin 7y agoIf the ReasonML TodoMVC app was using the same basic approach as the Vanilla JS app, there is no way it would be shipping 5x as much code. ReasonML code compiles pretty much 1-to-1 to JavaScript. It does pull in a bit of a runtime if you use some standard OCaml libraries, most of that should be quite easy to eliminate with a good bundler.