I'm working in a monorepo with a lot of OCaml libraries that are (wrapped false) (see dune stanza reference)
Is using dune wrapped libraries with explicit module interfaces likely to reduce link times?
For example, assume binary depends on lib_a:
- dune (declares `binary` library, which depends on `lib_a`)
- binary.ml
/ lib_a
- dune (declares `lib_a` library)
- lib_a_helpers.ml
- lib_a_helpers.mli
- lib_a.ml
- lib_a.mli (does not expose any symbols from lib_a_helpers)
My mental model is:
- If
lib_auses(wrapped true)then the symbols fromlib_a_helpers.mlwill not be in thelib_a.a. - Then the linker has fewer symbols to search through when creating
binary.opt - So I expect linking will be faster, but am not sure
Using wrapped libraries can only slightly slow down the build time: the wrapped library adds another module (the library entry point) which re-exports aliases to some of the internal modules. In particular, it does not remove any modules from the library.