Download


Download a zip file containing source to run the benchmark for 1000, 5000, 10000, 50000 and 100000 #includes

make_include - a program to create the benchmark files. Download source or a Win32 executable.

time_include - a program to run and time the benchmark. Download source or a Win32 executable.


How to use the software

makeincl produces two header files - guard.h and noguard.h and, for each number you specify on the command line, three C source files:

egxxxx.c - External include guards
igxxxx.c - Internal include guards
ngxxxx.c - No include guards
(The xxxx will be the number of includes in the file)
E.g. running "makeincl 20000" will produce the following files:
guard.h
noguard.h
eg20000.c
ig20000.c
ng20000.c

If timeincl will run on your machine, you can run it with the compiler and the number of #includes it is to run on specified on the command line.

E.g. On my PII 300 Mhz, Windows 98 I used the following sequence to get my test results:

makeincl 10000
timeincl wpp386 10000
timeincl wcc386 10000

Timeincl does not work under all operating systems, however since the timing requirements for this benchmark are not particularly stringent you can equally well time by hand, or maybe write a small script. To time the GNU compiler running under Linux I used the following:

time gcc -c eg100000.c
time gcc -c ig100000.c
time gcc -c ng100000.c

Make sure that you use whatever compiler options are required to turn off any linking - all we are trying to time is compiling a single source file.

You need to pick the number of includes such that the timings are large enough to give useful comparisons.


Results

Back to main include guard page

Email me

This page last modified 8 October 1999