ENH: Optimize performance by caching stat results

This commit is contained in:
Andy Cedilnik 2005-10-12 13:51:15 -04:00
parent 2dd035c9a9
commit a51dfefe79
2 changed files with 11 additions and 1 deletions

View File

@ -21,6 +21,7 @@
#include "cmLocalGenerator.h" #include "cmLocalGenerator.h"
#include "cmCommands.h" #include "cmCommands.h"
#include "cmCommand.h" #include "cmCommand.h"
#include "cmFileTimeComparison.h"
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback. # include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
@ -95,6 +96,7 @@ cmake::cmake()
{ {
m_DebugTryCompile = false; m_DebugTryCompile = false;
m_ClearBuildSystem = false; m_ClearBuildSystem = false;
m_FileComparison = new cmFileTimeComparison;
#ifdef __APPLE__ #ifdef __APPLE__
struct rlimit rlp; struct rlimit rlp;
@ -157,6 +159,7 @@ cmake::~cmake()
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
delete m_VariableWatch; delete m_VariableWatch;
#endif #endif
delete m_FileComparison;
} }
void cmake::CleanupCommandsAndMacros() void cmake::CleanupCommandsAndMacros()
@ -1739,7 +1742,7 @@ int cmake::CheckBuildSystem()
out != outputs.end(); ++out) out != outputs.end(); ++out)
{ {
int result = 0; int result = 0;
if(!cmSystemTools::FileTimeCompare(out->c_str(), dep->c_str(), &result) || if(!m_FileComparison->FileTimeCompare(out->c_str(), dep->c_str(), &result) ||
result < 0) result < 0)
{ {
return 1; return 1;

View File

@ -48,6 +48,7 @@ class cmCacheManager;
class cmMakefile; class cmMakefile;
class cmCommand; class cmCommand;
class cmVariableWatch; class cmVariableWatch;
class cmFileTimeComparison;
class cmake class cmake
{ {
@ -262,6 +263,11 @@ class cmake
*/ */
int AddCMakePaths(const char *arg0); int AddCMakePaths(const char *arg0);
/**
* Get the file comparison class
*/
cmFileTimeComparison* GetFileComparison() { return m_FileComparison; }
protected: protected:
typedef cmGlobalGenerator* (*CreateGeneratorFunctionType)(); typedef cmGlobalGenerator* (*CreateGeneratorFunctionType)();
typedef std::map<cmStdString, CreateGeneratorFunctionType> RegisteredGeneratorsMap; typedef std::map<cmStdString, CreateGeneratorFunctionType> RegisteredGeneratorsMap;
@ -313,6 +319,7 @@ private:
std::string m_CheckBuildSystem; std::string m_CheckBuildSystem;
bool m_ClearBuildSystem; bool m_ClearBuildSystem;
bool m_DebugTryCompile; bool m_DebugTryCompile;
cmFileTimeComparison* m_FileComparison;
void UpdateConversionPathTable(); void UpdateConversionPathTable();
}; };