Some customers have reported instrumented builds with Coco to be significantly slower than without. This can have different causes.
The unavoidable overhead¶
Compilation with Coco is always a bit slower than without it. This is because the Coco compiler wrapper runs the compiler twice for each source file, in the following process:
It runs the compiler to preprocess the source file, resulting in a temporary file.
The preprocessed file is instrumented, resulting in another temporary file.
Coco runs the compiler again to compile the instrumented source.
So one should expect that the compilation time approximately doubles. With Visual Studio, it could take even more time because the Visual Studio compiler is especially slow on already preprocessed files.
Avoidable overhead¶
If the instrumented compilation takes much more time than that, something else may be the cause.
Network shares¶
One possible cause for problems are network shares.
If a compilation takes place on the file system of a remote machine, then for each source file, two more temporary files need to be copied back and forth between the computer and the remote file system. Any network delay therefore multiplies.
The best method to mitigate this problem is to compile locally. If
that is not possible, one can advise Coco to store the temporary files
locally. This can be done by setting the environment variable
SQUISHCOCO_TEMP_DIR
to the path of an existing directory on the
local machine.
License server¶
Each time a file is compiled, the compiler wrapper requests a license from the Coco license server via a network connection. If the connection is slow, this can therefore slow down a large compilation with thousands of files considerably.
It may therefore be helpful to check for possible network problems. One can use ping to measure the round-trip time betwen the compilation machine and the license server. Values of approximately 10 milliseconds or less are recommended.
Virus scanner¶
On some machines, a virus scanner runs that checks each newly created file. This creates additional disk activity which can slow down the compilation.
The simplest remedy is of course to switch the virus scanner off. But
if this is not possible, one can use the environment variable
SQUISHCOCO_TEMP_DIR
to redirect the temporary files to a directory
that is not read by the virus scanner (if such a directory exists).
A final tip¶
With Microsoft Visual Studio, compilation becomes faster if precompiled headers are enabled.