3 ms·
I'm interested in Reason/Buckle, coming myself from the ClojureScript. The seemingly tinier minified compilation size would be a huge plus. But what are the ac
by vemv 9y ago
I'm interested in Reason/Buckle, coming myself from the ClojureScript.
The seemingly tinier minified compilation size would be a huge plus. But what are the actual sizes emitted for large scale projects (arguably the ones that matter most for static typing)? Anyone could share real-world experiences?
For reference: I know of cases where 60K lines of clojurescript (arguably equivalent to 150K lines JS) compile down to 5MB under advanced optimization mode.
(in case that scares you: well it's an actually large app. We should do route-based code splitting soon - easy/robust with clojurescript apparently)
- dangerbird2 9y agoOne thing bucklescript has going for it is that it plays nicely with the NPM/webpack ecosystem. If you want your bundled code to be optimized and minified like Clojurescript, just use a plugin/loader for webpack or your bundler of choice to run the Closure compiler or a similar javascript optimizer. Despite being more inflexible about tooling, clojurescript is great because of how it generates code specifically to take advantage of Closure's optimizaitons.
- lilactown 9y agoHey, author here! BuckleScript itself doesn't actually do any sort of bundling or minification of the code - in fact, it prides itself in generating "human readable" code that, worst comes to worst, one could modify by hand and not be too hung out to dry. So in that case, you are at the mercy of the general JS ecosystem when it comes to module bundling, minification, code splitting, etc. The Google Closure compiler does a lot of the magic behind ClojureScript's advanced optimizations, so theoretically one could leverage those same optimizations with an app compiled by BuckleScript. Unfortunately, I don't have any real-world experiences with this. However, I do have experience using ClojureScript + Google Closure compiler and can give you a heads up that you might (...probably will) run into issues using Closure compiler with NPM libraries, which the BuckleScript ecosystem relies on. As someone who recently started working daily with ClojureScript, I'm really crossing my fingers for some of rough edges around Node.js/ES module support in the Closure compiler to be smoothed out soon! NINJA edit: I have heard good things about rollup with regards to dead-code elimination and other optimizations, but the JS module bundling story is moving at break-neck speed these days and I'm not really keeping up with it - Parcel's a new thing? Jaredly's writing a bundler in ReasonML?? X_X
- yawaramin 9y agoThat's a very interesting question. We could ask some Messenger and Instagram people, since they are heavily using BuckleScript. In general output JS is already fairly spartan, because BuckleScript uses a few tricks here and there, like encoding modules and records as arrays instead of objects; and completely inlining functions whenever it can. BuckleScript also emits ES6 modules, with imports and exports, and it marks its output as either pure or impure at the module level. So potentially there's a lot of room for bundlers to do tree-shaking. Bob Zhang, the BuckleScript team lead, is working on a new typesafe standard library for BuckleScript, which takes advantage of compile-time checks to compile to extremely minimal and idiomatic JS. Exciting times up ahead!
- Hurtak 9y agoI have heard about the Messenger where they have 25-50% of the web client codebase in Reason, but I have not heard about the Instagram story. Can you share more info or some links about that?
- yawaramin 9y agoHi, about Instagram, I was mistaken about 'heavy' use. As far as I know there is one guy using Reason in Insta and from what he's said, he's found it pretty straightforward. I don't have a direct link, but if you search for 'instagram' in the ReasonML Discord chat you will find the discussion.