How do dune wrapped libraries with explicit module interfaces affect build speed?

65 Views Asked by At

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_a uses (wrapped true) then the symbols from lib_a_helpers.ml will not be in the lib_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
1

There are 1 best solutions below

0
octachron On

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.