Lwt_ppx binary footprint

just adding the dependency lwt_ppx makes the according stripped amd64 binary grow from 12MB to 21MB. Am I holding it wrong or is that normal? I am surprised syntactic sugar adds to the binary size.

I still suffer a trauma from unicode (uucp?) adding 4MB.

Refer to it only in the preprocess stanza, not as a library. Otherwise, you’ll include parts of the compiler into your executable…

$ cat dune
(executable (name test) (libraries lwt.unix lwt_ppx))
$ ls -l _build/default/test.exe
-r-xr-xr-x 1 ghs ghs 21520696 Mar 28 23:16 _build/default/test.exe
$ cat dune
(executable (name test) (libraries lwt.unix) (preprocess (pps lwt_ppx)))
$ dune exec ./test.exe
hello
$ ls -l _build/default/test.exe
-r-xr-xr-x 1 ghs ghs 4642352 Mar 28 23:17 _build/default/test.exe
3 Likes

thanks a lot, that works perfect and makes so much sense!

follow up question:

Is there sugar for try_bind?

Edit: I will nest lwt%try and lwt%let, nice!