Here is a Ruby script that I have used to inspect the size of modules inside an OCaml binary on Linux by analyzing its nm(1) output: https://gist.github.com/lindig/7ab6c663f7bb763322f65b7cda60f29c. It can also take two binaries. Output looks like this:
$ ~/src/tmp/size.rb _build/default/xc/xenops_xc_main.exe
# modules in _build/default/xc/xenops_xc_main.exe (size in Kb)
Arg 10.7
Arg_helper 3.1
Array 11.5
ArrayLabels 0.3
Ast_402 54.5
Ast_403 56.0
Ast_404 56.8
Ast_405 59.3
Ast_406 60.1
Ast_407 60.1
Ast_convenience 4.9
Ast_helper 30.3
Ast_invariants 2.5
Ast_iterator 12.5
Ast_mapper 36.3
Astring 3.1
Astring_base 2.2
Astring_char 1.5
Astring_escape 4.4
Astring_string 23.7
Astring_sub 21.2
Astring_unsafe 0.3
Attr_helper 0.8
B64 2.7
Backtrace 10.3
Base 10.0
Base__Applicative 5.1
Base__Applicative_intf 0.5
Base__Array 20.6
Base__Array0 0.9
Base__Array_permute 0.4
Base__Avltree 8.7
Base__Backtrace 1.0
Base__Binary_search 2.4
Base__Binary_searchable 0.6
Base__Binary_searchable_intf 0.0
Base__Blit 2.3
Base__Blit_intf 0.0
Base__Bool 1.3
Base__Buffer 0.7
Base__Buffer_intf 0.0
Base__Bytes 3.8
Base__Bytes0 0.3
Base__Bytes_set_primitives 0.0
...omitted...
Xenbus_utils 0.8
Xenctrl 1.3
Xenctrlext 0.0
XenguestHelper 6.4
Xenops_client 1.4
Xenops_helpers 0.9
Xenops_hooks 2.6
Xenops_interface 294.1
Xenops_migrate 4.9
Xenops_server 139.4
Xenops_server_plugin 1.8
Xenops_server_skeleton 3.3
Xenops_server_xen 133.1
Xenops_task 3.6
Xenops_types 116.0
Xenops_utils 28.8
Xenops_xc_main 2.0
Xenopsd 8.0
Xenstore 3.6
Xenstore_watch 0.1
Xmlm 41.5
Xmlrpc 14.0
Xs_client_unix 12.1
Xs_handle 0.9
Xs_protocol 18.2
Xs_transport 0.6
Xs_transport_unix_client 0.9
Yojson 155.5
_startup 39.2
_system
```