>From my experience my elm app freshly compiled ends up at 2369KB, after 
closure, uglifyjs, etc... it ends up at 1145KB, then when gzipped it ends 
up at 338KB.  This is still pretty large considering the old react version 
of some of the components I replaced were less that 400KB pre-shrinking 
total (using react.min.js admittedly, never used the non-min react library) 
and much smaller after shrinking and gzipping.

For an example let's take 
[Bucklescript](https://bloomberg.github.io/bucklescript/), which adds a 
javascript back-end for the stock OCaml compiler, I.E. normal OCaml input, 
OCaml-compiler-optimized output to javascript, which includes DCE (Dead 
Code Elimination), inlining, and more, and they can compile the OCaml 
compiler (which is written in OCaml) to javascript, and have done so on 
their [Try 
Bucklescript](https://bloomberg.github.io/bucklescript/js-demo/index.html) 
page, where you can see it does directly convert `print_endline "Hello 
World!"` into `console.log("Hello World!");`, and as you import modules it 
optimizes what is used and not used and makes for very tight programs 
(while using OCaml-style normal FFI for integrating with javascript 
type-safe).

I would actually be quite curious in Elm taking a similar approach, build 
on top of an already well defined and strongly typed language instead of 
inventing a new language.  Elm is not the language but rather the style in 
my point of view.

(Honestly a dream browser language would be either OCaml or Haskell with an 
Elm-like library for interfacing, probably OCaml over Haskell.)

Segway aside, no, the closure compiler still does not shrink Elm very well 
even in mid-late 2016.

On Saturday, September 10, 2016 at 11:19:52 AM UTC-6, Brian Slesinsky wrote:
>
> Delegating to Closure is smart but the combination still needs to be 
> tested to really claim code size is solved. Writing code to allow tree 
> shaking isn't an entirely natural thing - new dependencies can happen 
> easily unless you have testing to tell you that code size has regressed.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to