[github patch] add an -opaque option to produce optimization-empty .cmx file for separate native compilation #6389
Original bug ID: 6389
The intent of this option is to enable semi-separate native
This would be of practical value for development cycles of project
Reviewers noted that the "does not recompile dependencies when implementation changes" aspect only works for build-system that are content-based rather than timestamp-based, as recompiling the .cmx will update its modification time. I think this is fine, and that changing the compilation process to please timestamp-based system is an orthogonal question that should be discussed separately.
Comment author: @alainfrisch
I've done a test on LexiFi's code base. For a given source file change and build target, compilation takes 24s without -opaque and 16s with -opaque. The gain is not huge, but we also need to link many executables (and this cannot be avoided!) and omake itself takes some time to parse and evaluate OMakefiles and check timestamp/digests (about 5s).
I assume that for some other scenarios, the gain would be more important.
Gabriel: since nobody else objected to the feature and it seems harmless, I think you can commit your patch on the trunk.
Comment author: @gasche
I just rebased the patch against the current trunk. I am about to commit it -- only for now, but I'll check with Damien that it can go in 4.02 as well.
Currently the -opaque option is only supported by ocamlopt. Do you think it should be supported (and ignored) by ocamlc as well? I see you did a similar change for -for-pack.