You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7436 Reporter:@Drup Status: resolved (set by @xavierleroy on 2017-02-19T17:20:44Z) Resolution: won't fix Priority: normal Severity: tweak Version: 4.04.0 Category: typing Monitored by:@Drup
Bug description
When encountering a with constraints, signatures are expanded in Types.module_type (indeed, there is no Mty_with ..). Same for "module type of".
This cause issues for libraries with a big API surface that is instantiated several time. Tyxml is such example. In the file 1 which can be found in eliom, the same (big) signature is copied 6 time. The size of the resulting cmi is 2.0Mo. The size is such that it slows compilation notably (See 2).
One solution, which we are probably going to adopt, is to factor the module type out and share it among the various instances. It's possible in this case since most constraints are the same.
It would be nice if the cmi format could be compact in this case, by storing the with constraints.
Steps to reproduce
An easy test case, using tyxml alone (compiled with ocamlfind ocamlc -package tyxml -c foo.ml).
module type Foo =
Html_sigs.Make(Tyxml.Xml)(Tyxml.Svg).T
the cmi file is 622o
module type Foo =
Html_sigs.Make(Tyxml.Xml)(Tyxml.Svg).T
with type 'a wrap = 'a
the cmi file is 199Ko
The text was updated successfully, but these errors were encountered:
"with" constraints are expanded during elaboration to internal module types, in large part because nobody knows how to work with module types (checking subtyping, etc) if "with" constraints were still there. .cmi files contain those internal module types obtained by elaboration. I have zero hope that the compactness of the "with" notation could be recovered a posteriori before writing .cmi files. So, I'm respectfully going to close this feature wish.
Original bug ID: 7436
Reporter: @Drup
Status: resolved (set by @xavierleroy on 2017-02-19T17:20:44Z)
Resolution: won't fix
Priority: normal
Severity: tweak
Version: 4.04.0
Category: typing
Monitored by: @Drup
Bug description
When encountering a with constraints, signatures are expanded in Types.module_type (indeed, there is no Mty_with ..). Same for "module type of".
This cause issues for libraries with a big API surface that is instantiated several time. Tyxml is such example. In the file 1 which can be found in eliom, the same (big) signature is copied 6 time. The size of the resulting cmi is 2.0Mo. The size is such that it slows compilation notably (See 2).
One solution, which we are probably going to adopt, is to factor the module type out and share it among the various instances. It's possible in this case since most constraints are the same.
It would be nice if the cmi format could be compact in this case, by storing the with constraints.
Steps to reproduce
An easy test case, using tyxml alone (compiled with
ocamlfind ocamlc -package tyxml -c foo.ml
).the cmi file is 622o
the cmi file is 199Ko
The text was updated successfully, but these errors were encountered: