On 2013-11-22 8:33 AM, Mike Hommey wrote:
On Thu, Nov 14, 2013 at 05:49:33PM -0500, Ehsan Akhgari wrote:
I've started to work on a project in my spare time to switch us to use
unified builds for C/C++ compilation. The way that unified builds work is
by using the UNIFIED_SOURCES instead of the SOURCES variable in moz.build
files. With that, the build system creates files such as:
// Unified_cpp_path_0.cpp
#include "Source1.cpp"
#include "Source2.cpp"
// ...
And compiles them instead of the individual source files.
The advantage of this is that it speeds up the compilation (I've measured
between 6-15x speed improvement depending on the code in question
locally.) But there are also trade-offs with this approach. One trade-off
is that the source code might require changes before it can be compiled in
this way, due to things like name clashes, etc. The other one is that if
you change one .cpp file which is built in unified mode, we would spend
more time compiling it because we'll be compiling the unified .cpp file
which includes more than what you have changed. It's hard to come up with
numbers for this trade-off, but assuming that the linking step takes way
longer than the C++ compilation in the "touch one .cpp file" scenario, and
also that changes to headers will potentially trigger multiple .cpp
rebuilds in the same directory, I think doing unified builds in more parts
of the tree is a reasonable choice.
I'm going to continue working on this as time permits, if you're interested
in helping out, or if you have questions, please get in touch.
Well, it didn't take long. A build with unified sources disabled already
fails:
layout/style/nsStyleUtil.h:62:12: error: member access into incomplete
type 'nsAString_internal'
aResult.AppendFloat(aNumber);
^
../../dist/include/nsXPCOM.h:20:12: note: forward declaration
of 'nsAString_internal'
DECL_CLASS(nsAString);
Filed bug 942193.
Ehsan
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform