Results


Compiler Operating System Hardware Number of includes used for test Time for external include guard compile Time for internal include guard compile Time for no include guard compile Include guard optimisation implemented?
Watcom C++ 11.0
(wpp386)
Windows 98 Pentium II 300 MHz 10,000 0.27 s 0.50 s 7.69 s YES
Watcom C 11.0
(wcc386)
Windows 98 Pentium II 300 MHz 10,000 0.27 s 10.88 s 12.86 s NO
Cygwin B20.1 EGCS (2.91.57) NT 4.0, SP3 (using Cygwin B20.1 bash shell) Pentium II 400 Mhz 100,000 1.9 s 1.5 s 88.5 s YES
Cygwin B20.1 EGCS (2.91.57) - running over networked drive NT 4.0, SP3 (using Cygwin B20.1 bash shell) Pentium II 400 Mhz 100,000 10.9 s 4.9 s 450.9 s YES
gcc version egcs-2.91.66 (egcs-1.1.2 release) S.u.S.E. Linux 6.2 Pentium II 300 MHz 100,000 4 s 3 s 16 s YES
gcc version 2.95.1 19990816 (release) Debian GNU/Linux 2.1 Dual Pentium II 400Mhz 100,000 0.9 s 0.6 s 10.2 s YES
SparcWorks SC4.2 Solaris 2.6 Ultra 2300, 2*300Mhz Ultra Sparc 100,000 2.1 s 19.2 s 22.7 s NO
SparcWorks SC5.0 Solaris 2.6 Ultra 2300, 2*300Mhz Ultra Sparc 100,000 3.4 s 23.5 s 33.0 s NO
Microsoft VC5 SP3 NT4 SP5 Dual Pentium II 450Mhz (Compaq AP500) 10,000 0.2 s 10.68 s 11.2 s NO
Microsoft VC5 SP3 using precompiled headers NT4 SP5 Dual Pentium II 450Mhz (Compaq AP500) 10,000 0.2 s 3.2 s 3.1 s Not applicable due to use of precompiled headers
Microsoft VC6 SP3 NT4 SP5 Dual Pentium II 450Mhz (Compaq AP500) 10,000 0.2 s 11.2 s 11.7 s NO
Microsoft VC6 SP3 using precompiled headers NT4 SP5 Dual Pentium II 450Mhz (Compaq AP500) 10,000 0.2 s 3.1 s 3.2 s Not applicable due to use of precompiled headers
Borland C++ Builder 3.0 (bcc32 v 5.3) NT 4.0, sp 5 Pentium II 350 Mhz 10,000 0.36 s 9.84 s 10.92 s NO
Borland C++ Builder 4 (bcc32 v 5.4) NT 4.0, SP3 (using Cygwin B20.1 bash shell) Pentium II 400 Mhz 100,000 0.7 s 1.5 s 61.6 s YES
Borland C++ Builder 4 (bcc32 v 5.4) - running over networked drive NT 4.0, SP3 (using Cygwin B20.1 bash shell) Pentium II 400 Mhz 100,000 7.8 s 2.6 s 498.1 s YES
Microsoft Visual Studio 2008 Windows 7 AMD Opteron 165 Dual Core 1.81 GHz 50,000 0.13 s 5.48 s 5.77 s NO
GCC 4.5.2 (mingw32) Windows 7 64 bit Intel Core i7 2600 3.4Ghz 100,000 0.14 s 0.11 s 5.21 s YES
GCC 4.2.1 OpenBSD 5.0 loongson laptop (800Mhz) 10,000 0.14 s 0.10 s 0.79 s YES
GCC 4.7.3 Ubuntu 13.04/Linux 3.8 Intel Core i5-2450M CPU @ 2.50GHz × 4 3,000,000 2.160 s 1.263 s 21.562 s YES
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21114 for x86 (Nov 2013 CTP) Windows 7 64 bit Intel Core 2 Quad CPU Q8400 @ 2.66 GHz 1,000,000 0.59 s 13.74 s 75.24 s NO (1)
GCC 4.8.2 Cygwin 64 bit running on Windows 7 64 bit Intel Core 2 Quad CPU Q8400 @ 2.66 GHz 1,000,000 0.959 s 0.811 s 102.545 s YES


Notes

  1. These results are odd. The internal include guards are much slower than the external include guards, but no incude guards are vastly slower. Clearly the compiler is doing something with the internal include guards, but it isn't the same optimization as (say) GCC is implementing.

The only thing these timings should be used for is to assess whether a particular compiler has implemented the internal include guard optimisation.

Thank you to everyone who has submitted results. If you would like to submit results for a compiler not yet listed, please make sure you include all of the details mentioned in the table.


Back to main include guard page

Email me

This page last modified 1 October 2014