
On 9 Jun 2009, at 16:59, Zachary Turner wrote:
I would like to propose conditional support for #pragma once be added to all header files in boost. This would involve, at the beginning of every header file, a preprocessor check to determine whether or not the particular compiler is on a whitelist of known compilers to optimized #pragma once. If so, #pragma once is used. so, something like this:
Here are the build timings on my machine (Visual Studio 2008 Service Pack 2)
RedundantGuard - 1 second compile + link time PragmaOnce - 1 second compile + link time Nothing - 15 seconds compile + link time
Here are my build-timings on g++, Mac OS X. I had to remove 3 of the header files (I emptied the files Header197, 198 and 199) due to gcc complaining about include depth. I hope this won't effect things too much. I also had to change the return type of main to int. I compiled by doing "g++ main.cpp" Note that modern g++ does support '#pragma once' fine. I get the following results: RedundantGuard: 0.130s Nothing: 0.170s PragmaOnce: 0.710s So PragmaOnce is over 7 times slower. That time is almost entirely in the 'sys' column, so I suspect it querying files to check if they are identical or not. Chris