I am having issues with compile times in my code base. I have found the culprit to be the two lines shown below. With the below code, it takes about 1m 40s to compile.
bool successful=true;
successful&=TreeDebug().run();
successful&=FileDebug().run();
time g++ -static-libgcc -static-libstdc++ -Wall -I . -o bin/mainDebug.exe debug/*.hpp debug/*.cpp src/*.hpp src/*.cpp
real 1m41.439s
user 0m0.000s
sys 0m0.015s
Separating the creation of the debug objects and the calling of the run method on that object reduces the compile time to 0m 15s.
bool successful=true;
TreeDebug treeDebug;
FileDebug fileDebug;
successful&=treeDebug.run();
successful&=fileDebug.run();
time g++ -static-libgcc -static-libstdc++ -Wall -I . -o bin/mainDebug.exe debug/*.hpp debug/*.cpp src/*.hpp src/*.cpp
real 0m14.159s
user 0m0.000s
sys 0m0.015s
What is happening that would increase the time to compile so drastically?
The Tree
class is a template class, but the last result proves that it is not the template that is causing the issue.