Method

Update to C++ compilation test done previously, and supplement continuous timing results.

Five compilers are tested:

gcc-4.1 gcc-4.4 gcc-4.6 clang-2.8 icc-2.8

For each, run through 2557 individual translation units comprised of select files from the libstdc++ testsuite directory using scripts/check_compile_only. Of the initial 4789 files, all C++0x files were removed, and then other problematic files were removed based on early results. The goal is to have a select number of files, including a limited number of known negative tests, that can be compiled by a wide variety of compilers. No attempt is made to cache or parallelize compiles, indeed the point is to compile sequentially.

The test machine is a corei7/12GB machine running F14/x86_64.

Compile flags were varied to try and measure various parts of the compiler in isolation.

Times were collected for various options:

When PCH files are used, the size of the generated file is noted. Time is in seconds. A percentage is given, and that is the ratio of elapsed seconds over the "iwyu" time.

Opinions vary widely on what style of C++ constitutes a good test case for measuring compilation speed. Users of C++ compilers no doubt have their own favorite pathological code examples. For that reason, we should ideally include more than one set of sources, instead of relying on one particular project. No doubt code samples can be constructed that highlight the deficiencies of any compiler, so examples should be taken with a grain of salt, and should be re-sampled to account for new designs and techniques. For instance, meta-programming techniques, which already tax C++ front ends, might have difference performance footprints on varying implementations.

Candidates for base source material for additional tests include parts of KDE or webkit or testsuites thereof, boost or boost::mpl, others.

Compilation Speed

ONE

gcc-4.6 (2010-12-01) command line

fail

pch size

time

%

-S -O0, "iwyu"

34

418

100

-S -O0 -include=stdc++.h "prefix"

32

1152

276

-S -O0 -include=stdc++.h

32

26

179

43

-S -O0 -g -include=stdc++.h

32

27

206

49

-S -O2 -include=stdc++.h

32

26

322

77

-S -O0 -std=gnu++0x -include=stdc++.h

42

46

397

95

TWO

gcc-4.4 (2010-12-01) command line

fail

pch size

time

%

-S -O0, "iwyu"

34

390

100

-S -O0 -include=stdc++.h "prefix"

32

1035

265

-S -O0 -include=stdc++.h

32

27

176

45

-S -O0 -g -include=stdc++.h

32

30

200

51

-S -O2 -include=stdc++.h

32

27

304

78

-S -O0 -std=gnu++0x -include=stdc++.h

52

40

244

63

THREE

gcc-4.1 (2010-12-08) command line

fail

pch size

time

%

-S -O0, "iwyu"

25

453

100

-S -O0 -include=stdc++.h "prefix"

24

890

196

-S -O0 -include=stdc++.h

24

30

188

42

-S -O0 -g -include=stdc++.h

24

31

224

49

-S -O2 -include=stdc++.h

24

30

353

78

FOUR

clang-2.8 (2010-12-08) command line

fail

pch size

time

%

-S -O0, "iwyu"

285

493

100

-S -O0 -g

285

504

102

-S -O2

285

545

111

-S -O0 -include=stdc++.h "prefix"

284

992

201

-S -O0 -include=stdc++.h

1381

5.1

188

38

FIVE

icc-12 (2010-12-08) command line

fail

pch size

time

%

-S -O0, "iwyu"

27

611

100

-S -O0 -pch

34

346(8.2GB)

364

60

-S -O0 -g -pch

34

446

73

-S -O2 -pch

34

541

88

-S -O0 -include=stdc++.h "prefix"

26

1068

175

-S -O0 -include=stdc++.h -pch

33

346(16.5GB)

520

85

-S -O0 -include=stdc++.h

43

Observations

GCC Notes: PCH timings remarkably consistent through generations. Worrisome compilation speed with -std=gnu++0x as features mature. Runtime sources tested are as per GCC version under test.

ICC Notes: weakref means extern. Runtime sources tested are as per GCC 4.1. Has explicit creation and use flags, unable to use manual pch files via -pch-create/-pch-use nor via deprecated -create_pch/-use_pch. Has automatic PCH mode via -pch flag. Can be used with runtime sources more recent than GCC 4.1. For the 4.4 release, see 137 total fails. (New fails from 4.3+ variadic template use in tr1/type_traits and tr1/tuple). For the 4.6 release, see 551 total fails. (New fails from float = float complex, invalid multibyte sequence, is_trivial, decltype)

Clang Notes: weakref means static. Runtime sources tested are as per GCC 4.1. No equivalent to -fpermissive. Template specialization parse error, -Wbool-conversions, dependant type lookup vs. typename, template argument deduction, template template parameters. Has explicit creation and use flags (-emit-pch/-include-pch) and supports other header caching schemes. Parse is strict and includes more syntax checking on template bodies than other compilers, but less flexibility to selectively turn off diagnostics.

None: CompilationSpeed (last edited 2010-12-16 21:53:07 by BenjaminKosnik)