- Native code compilation still includes symbols. Stripping that reduces the size at the obvious cost of debugging ease.
- When an OCaml module is touched for a single function, the entire module is included at present. OCaml 4.02.0 included module aliases to make it easier to break down module hierarchies into less monolithic chunks. They work by exposing module equivalence in the signature, and reduced the size of Unix binaries in Jane Street Core by 90% in some cases; https://blogs.janestreet.com/better-namespaces-through-modul...
- Bytecode (while less performant) can be compressed more easily than native code. We've had DNS and OpenFlow servers that are less than a megabyte in size quite easily when compiled with bytecode.
- Dead code elimination requires some whole program optimisation, and currently only works with bytecode via the OCamlClean tool: http://www.algo-prog.info/ocaml_for_pic/web/index.php?id=oca... . Porting this to native code is on the TODO list, but needs some fiddling with frame pointers in the generated binaries to do a good job.
So the overall answer is that reducing the deployed binary size is now a compiler problem, since the unikernel architecture lets us provide it with much more information (configuration files and OS libraries as well as the application logic).