Page MenuHomeFreeBSD

Significantly reduce compile time for googletest internal tests
ClosedPublic

Authored by arichardson on Oct 12 2020, 1:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 7, 3:29 PM
Unknown Object (File)
Mar 9 2024, 2:52 AM
Unknown Object (File)
Mar 9 2024, 2:48 AM
Unknown Object (File)
Mar 9 2024, 2:48 AM
Unknown Object (File)
Mar 9 2024, 2:48 AM
Unknown Object (File)
Mar 8 2024, 8:55 AM
Unknown Object (File)
Mar 2 2024, 3:54 AM
Unknown Object (File)
Jan 18 2024, 11:53 PM
Subscribers

Details

Summary

Clang's optimizer spends a really long time on these tests at -O2, so we now
use -O0 instead. This reduces the -j32 time for lib/googletest/test from 131s
to 29s. Using -O0 also reduces the disk usage from 144MB (at -O2) / 92MB (at
-O1) to 82MB.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

arichardson created this revision.

Do we even need this in default installs? As in, what happens if this does not get compiled at all?

Yes I'd also vote for turning this off by default. I have an open review that I need to update: https://reviews.freebsd.org/D26067

Might as well go full -O0. :)

This revision is now accepted and ready to land.Oct 19 2020, 7:17 PM
In D26751#599033, @dim wrote:

Might as well go full -O0. :)

Running the tests at -O2 in QEMU amd64 took:
44.52 real 27.28 user 13.96 sys
Changing it to -O1 makes it
91.80 real 73.32 user 14.28 sys
and -O0 results in
109.46 real 90.08 user 14.38 sys

So we might as well use -O0 since it doesn't seem to make much of a run time difference but has a big impact on compile time :)

In D26751#599033, @dim wrote:

Might as well go full -O0. :)

Running the tests at -O2 in QEMU amd64 took:
44.52 real 27.28 user 13.96 sys
Changing it to -O1 makes it
91.80 real 73.32 user 14.28 sys
and -O0 results in
109.46 real 90.08 user 14.38 sys

So we might as well use -O0 since it doesn't seem to make much of a run time difference but has a big impact on compile time :)

What is the disk space size like in each case?

In D26751#599214, @ngie wrote:
In D26751#599033, @dim wrote:

Might as well go full -O0. :)

Running the tests at -O2 in QEMU amd64 took:
44.52 real 27.28 user 13.96 sys
Changing it to -O1 makes it
91.80 real 73.32 user 14.28 sys
and -O0 results in
109.46 real 90.08 user 14.38 sys

So we might as well use -O0 since it doesn't seem to make much of a run time difference but has a big impact on compile time :)

What is the disk space size like in each case?

O0:
82M /home/alr48/cheri/output/freebsd-amd64/usr/tests/lib/googletest/

O1:
92M /home/alr48/cheri/output/freebsd-amd64/usr/tests/lib/googletest/

O2:
144M /home/alr48/cheri/output/freebsd-amd64/usr/tests/lib/googletest/

So it seems like the aggressive inlining at -O2 also increases the disk space requirements.

Use -O0 instead and update comment

This revision now requires review to proceed.Oct 20 2020, 8:04 AM

No blocking concerns.

lib/googletest/tests/Makefile.inc
10–13 ↗(On Diff #78489)

I'd add "At time of writing" to this statement and mention "amd64"/"arm64" for reference, given that this might change in the future or fluctuate.

15–17 ↗(On Diff #78489)

What does -g0 do? I really wish the clang manpage/documentation was better about describing this like gcc's is.

This revision is now accepted and ready to land.Oct 20 2020, 7:02 PM
lib/googletest/tests/Makefile.inc
10–13 ↗(On Diff #78489)

sounds good, will do.

15–17 ↗(On Diff #78489)

-g0 disables debug info (gcc-compatible flag).