2.2 seconds out of my 7.5 seconds configure time is spent looking for two binaries in CTest.cmake

I am working on a large project using cmake. Profiling with --profiling-format google-trace showed the following:

2.2 seconds out of my 7.5 seconds configure time is spent looking for MEMORYCHECK_COMMAND and COVERAGE_COMMAND in CTest.cmake on Windows.

Responsible code is here:

I configure frequently but I am currently not using either memory checks or code coverage. Would it be possible to opt-out of this functionality in order to speed up my configuration by 30%?

You must not include(CTest), use enable_testing()

If you do, you may waste time, but only on windows, it seems?

Interesting that the slow find_program() call uses a registry location for PATHS. I wonder if that might be related to why that particular call is so slow. Would be interesting to temporarily comment that out to see if it made any difference in your case.

1 Like

Thank you. Using enable_testing() instead of include(CTest) indeed reduced configuration time to roughly 5.5 seconds. Tests still seem to run fine on command line and in CLion.

I tried commenting out the two lines

    PATHS
    "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"

But this did not have much effect.

Changing to 1 instead of 6 commands, so instead of

NAMES purify valgrind boundscheck drmemory cuda-memcheck compute-sanitizer

to

NAMES purify

reduces time roughly linearly, to 800ms for include(CTest).