ENH: performance fixes for network depends
This commit is contained in:
parent
3d27a6a391
commit
2ba1c0ab06
|
@ -1904,8 +1904,11 @@ void cmLocalUnixMakefileGenerator::OutputCheckDepends(std::ostream& fout)
|
||||||
(*source)->GetDepends().begin();
|
(*source)->GetDepends().begin();
|
||||||
dep != (*source)->GetDepends().end(); ++dep)
|
dep != (*source)->GetDepends().end(); ++dep)
|
||||||
{
|
{
|
||||||
std::string dependfile =
|
// do not call CollapseFullPath on dep here, because it already
|
||||||
cmSystemTools::ConvertToOutputPath(cmSystemTools::CollapseFullPath(dep->c_str()).c_str());
|
// has been done because m_FullPath on cmDependInformation
|
||||||
|
// always is it called. If it is called here, network builds are
|
||||||
|
// very slow because of the number of stats
|
||||||
|
std::string dependfile = cmSystemTools::ConvertToOutputPath(dep->c_str());
|
||||||
// use the lower path function to create uniqe names
|
// use the lower path function to create uniqe names
|
||||||
std::string lowerpath = this->LowerCasePath(dependfile.c_str());
|
std::string lowerpath = this->LowerCasePath(dependfile.c_str());
|
||||||
if(emittedLowerPath.insert(lowerpath).second)
|
if(emittedLowerPath.insert(lowerpath).second)
|
||||||
|
|
|
@ -230,10 +230,7 @@ void cmMakeDepend::DependWalk(cmDependInformation* info)
|
||||||
void cmMakeDepend::AddDependency(cmDependInformation* info, const char* file)
|
void cmMakeDepend::AddDependency(cmDependInformation* info, const char* file)
|
||||||
{
|
{
|
||||||
cmDependInformation* dependInfo =
|
cmDependInformation* dependInfo =
|
||||||
this->GetDependInformation(file,
|
this->GetDependInformation(file, info->m_PathOnly.c_str());
|
||||||
cmSystemTools::GetFilenamePath(
|
|
||||||
cmSystemTools::CollapseFullPath(
|
|
||||||
info->m_FullPath.c_str())).c_str());
|
|
||||||
this->GenerateDependInformation(dependInfo);
|
this->GenerateDependInformation(dependInfo);
|
||||||
info->AddDependencies(dependInfo);
|
info->AddDependencies(dependInfo);
|
||||||
}
|
}
|
||||||
|
@ -257,6 +254,7 @@ cmDependInformation* cmMakeDepend::GetDependInformation(const char* file,
|
||||||
// Didn't find an instance. Create a new one and save it.
|
// Didn't find an instance. Create a new one and save it.
|
||||||
cmDependInformation* info = new cmDependInformation;
|
cmDependInformation* info = new cmDependInformation;
|
||||||
info->m_FullPath = fullPath;
|
info->m_FullPath = fullPath;
|
||||||
|
info->m_PathOnly = cmSystemTools::GetFilenamePath(fullPath.c_str());
|
||||||
info->m_IncludeName = file;
|
info->m_IncludeName = file;
|
||||||
m_DependInformationMap[fullPath] = info;
|
m_DependInformationMap[fullPath] = info;
|
||||||
return info;
|
return info;
|
||||||
|
@ -291,9 +289,31 @@ void cmMakeDepend::GenerateMakefileDependencies()
|
||||||
// find the full path to fname by searching the m_IncludeDirectories array
|
// find the full path to fname by searching the m_IncludeDirectories array
|
||||||
std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath)
|
std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath)
|
||||||
{
|
{
|
||||||
|
DirectoryToFileToPathMap::iterator m;
|
||||||
|
if(extraPath)
|
||||||
|
{
|
||||||
|
m = m_DirectoryToFileToPathMap.find(extraPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m = m_DirectoryToFileToPathMap.find("");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m != m_DirectoryToFileToPathMap.end())
|
||||||
|
{
|
||||||
|
FileToPathMap& map = m->second;
|
||||||
|
FileToPathMap::iterator p = map.find(fname);
|
||||||
|
if(p != map.end())
|
||||||
|
{
|
||||||
|
return p->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(cmSystemTools::FileExists(fname))
|
if(cmSystemTools::FileExists(fname))
|
||||||
{
|
{
|
||||||
return std::string(cmSystemTools::CollapseFullPath(fname));
|
std::string fp = cmSystemTools::CollapseFullPath(fname);
|
||||||
|
m_DirectoryToFileToPathMap[extraPath? extraPath: ""][fname] = fp;
|
||||||
|
return fp;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(std::vector<std::string>::iterator i = m_IncludeDirectories.begin();
|
for(std::vector<std::string>::iterator i = m_IncludeDirectories.begin();
|
||||||
|
@ -307,7 +327,9 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath)
|
||||||
path = path + fname;
|
path = path + fname;
|
||||||
if(cmSystemTools::FileExists(path.c_str()))
|
if(cmSystemTools::FileExists(path.c_str()))
|
||||||
{
|
{
|
||||||
return cmSystemTools::CollapseFullPath(path.c_str());
|
std::string fp = cmSystemTools::CollapseFullPath(path.c_str());
|
||||||
|
m_DirectoryToFileToPathMap[extraPath? extraPath: ""][fname] = fp;
|
||||||
|
return fp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +343,9 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath)
|
||||||
path = path + fname;
|
path = path + fname;
|
||||||
if(cmSystemTools::FileExists(path.c_str()))
|
if(cmSystemTools::FileExists(path.c_str()))
|
||||||
{
|
{
|
||||||
return cmSystemTools::CollapseFullPath(path.c_str());
|
std::string fp = cmSystemTools::CollapseFullPath(path.c_str());
|
||||||
|
m_DirectoryToFileToPathMap[extraPath][fname] = fp;
|
||||||
|
return fp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,11 @@ public:
|
||||||
*/
|
*/
|
||||||
std::string m_FullPath;
|
std::string m_FullPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Full path not including file name.
|
||||||
|
*/
|
||||||
|
std::string m_PathOnly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name used to #include this file.
|
* Name used to #include this file.
|
||||||
*/
|
*/
|
||||||
|
@ -154,8 +159,11 @@ protected:
|
||||||
cmsys::RegularExpression m_IncludeFileRegularExpression;
|
cmsys::RegularExpression m_IncludeFileRegularExpression;
|
||||||
cmsys::RegularExpression m_ComplainFileRegularExpression;
|
cmsys::RegularExpression m_ComplainFileRegularExpression;
|
||||||
std::vector<std::string> m_IncludeDirectories;
|
std::vector<std::string> m_IncludeDirectories;
|
||||||
|
typedef std::map<cmStdString, cmStdString> FileToPathMap;
|
||||||
|
typedef std::map<cmStdString, FileToPathMap> DirectoryToFileToPathMap;
|
||||||
typedef std::map<cmStdString, cmDependInformation*> DependInformationMap;
|
typedef std::map<cmStdString, cmDependInformation*> DependInformationMap;
|
||||||
DependInformationMap m_DependInformationMap;
|
DependInformationMap m_DependInformationMap;
|
||||||
|
DirectoryToFileToPathMap m_DirectoryToFileToPathMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue