bsansouci / bsb-native

Build system for OCaml/Reason
Other
245 stars 10 forks source link

Default setup produces huge native output #14

Closed ul closed 6 years ago

ul commented 6 years ago

With minimal setup https://gist.github.com/ul/7b54ddef9f19d34b271fe7ba52dfd574 I get

rprakapchuk@CLI-30528 ~/a/t/ocaml> la lib/bs/native/main.native 
-rwxr-xr-x  1 rprakapchuk  2032920826   1.1M  7 Nov 22:48 lib/bs/native/main.native

Setting "ocaml-dependencies": [] gives 201K, while plain ocamlopt Main.ml gives 193K

bsansouci commented 6 years ago

Hey! Thanks for reporting this. This was a conscious decision of ours to include a lot of libraries called “otherlibs” that are included in ocaml but not linked. The ones we link are Bigarray, Unix, Threads, Dynlink and Nums. You can also specify compiler-libs and we’ll do the right thing. Note here that the increase is just additional kB and not multiplicative. And you have some control over it by setting ocaml-dependencies to the minimal set that you want.

So my question here would be why do you need a smaller binary? What’s your current usecase?

ul commented 6 years ago

Yes, that decision sounds reasonable. I was just surprised having huge binary for helloworld, not that it is crucial for my usecase. Though I'm reimplementing really simple utility as an exercise, and having it already in 106K as Nim output sets the bar ;-)

bsansouci commented 6 years ago

Ok. Please come back when / if this becomes an issue. We have a lot to do so knowing what you really need is super helpful for us to prioritize tasks :)