GeckoCppUnitTests seem to wait for libxul to finishing linking before starting compilation

NEW
Unassigned

Status

()

Core
Build Config
2 years ago
a year ago

People

(Reporter: jrmuizel, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

2 years ago
This adds a bunch of latency to a clobber build.
I think this is because they build as CPP_UNIT_TESTS, which build as SIMPLE_PROGRAMS, which get compiled and linked in a single compiler invocation, and also they link to libxul, so they can't be compiled until they have a libxul to link against.
(Reporter)

Comment 2

2 years ago
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #1)
> I think this is because they build as CPP_UNIT_TESTS, which build as
> SIMPLE_PROGRAMS, which get compiled and linked in a single compiler
> invocation, and also they link to libxul, so they can't be compiled until
> they have a libxul to link against.

Is there any reason we wouldn't want to split out compilation of these from linking so that compilation can happen earlier?
You'll wind up with two compiler invocations per test instead of one. I don't know what sort of impact that'd have on the build time.

I wonder if we could just convert all of these tests to gtests?
(Reporter)

Comment 4

2 years ago
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #3)
> You'll wind up with two compiler invocations per test instead of one. I
> don't know what sort of impact that'd have on the build time.

The linker is still being invoked so it's hard for me to imagine that impact of two compiler invocations being noticeable, and being able to do work during libxul linking would help a lot for highly parallel builds.

> I wonder if we could just convert all of these tests to gtests?

Many of them likely can be.
(In reply to Jeff Muizelaar [:jrmuizel] from comment #2)
> (In reply to Ted Mielczarek [:ted.mielczarek] from comment #1)
> > I think this is because they build as CPP_UNIT_TESTS, which build as
> > SIMPLE_PROGRAMS, which get compiled and linked in a single compiler
> > invocation, and also they link to libxul, so they can't be compiled until
> > they have a libxul to link against.
> 
> Is there any reason we wouldn't want to split out compilation of these from
> linking so that compilation can happen earlier?

It's not worth the effort that would require to do it with the current backend. The compilations for those tests are not taking that long. The only caveat is that they have to wait for libxul, and that's not something that can change.
Created attachment 8763157 [details] [diff] [review]
PoC

When I said, yesterday, that it should be possible to split building libraries and objects easily, I actually didn't expect the patch to be this short. One downside is that it might make things slower in some edge cases (I'm thinking Windows, here, mostly), so I'm not putting this up for review with a proper commit message etc. until I have ruled that out, but please test this with your icecc setup and check whether it makes a significant difference.
Attachment #8763157 - Flags: feedback?(jmuizelaar)
Attachment #8763157 - Flags: feedback?(ehsan)

Comment 7

a year ago
Comment on attachment 8763157 [details] [diff] [review]
PoC

I'm not sure how to test this...
Attachment #8763157 - Flags: feedback?(ehsan)
You need to log in before you can comment on or make changes to this bug.