[Cmake-commits] [cmake-commits] alex committed cmDependsC.cxx 1.37 1.38
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Oct 6 13:57:44 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv10821
Modified Files:
cmDependsC.cxx
Log Message:
speedup C dependency scanning even more
Scanning the dependencies for kdelibs/khtml/ (when all files are scanned) is
now down to 4.6 s from 6.3 s before this change (without the
headerLocationCache it takes about 14 s here).
It doesn't really make sense to include the complete include path as part
of the key for the map, since the include path will be the same for
all files in a project, so it doesn't add anything.
Alex
Index: cmDependsC.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsC.cxx,v
retrieving revision 1.37
retrieving revision 1.38
diff -C 2 -d -r1.37 -r1.38
*** cmDependsC.cxx 28 Sep 2009 15:42:12 -0000 1.37
--- cmDependsC.cxx 6 Oct 2009 17:57:41 -0000 1.38
***************
*** 150,157 ****
std::set<cmStdString> scanned;
! // Use reserve to allocate enough memory for both strings,
// so that during the loops no memory is allocated or freed
- std::string cacheKey;
- cacheKey.reserve(4*1024);
std::string tempPathStr;
tempPathStr.reserve(4*1024);
--- 150,155 ----
std::set<cmStdString> scanned;
! // Use reserve to allocate enough memory for tempPathStr
// so that during the loops no memory is allocated or freed
std::string tempPathStr;
tempPathStr.reserve(4*1024);
***************
*** 182,201 ****
else
{
- // With GCC distribution of STL, assigning to a string directly
- // throws away the internal buffer of the left-hand-side. We
- // want to keep the pre-allocated buffer so we use C-style
- // string assignment and then operator+=. We could call
- // .clear() instead of assigning to an empty string but the
- // method does not exist on some older compilers.
- cacheKey = "";
- cacheKey += current.FileName;
-
- for(std::vector<std::string>::const_iterator i =
- this->IncludePath.begin(); i != this->IncludePath.end(); ++i)
- {
- cacheKey+=*i;
- }
std::map<cmStdString, cmStdString>::iterator
! headerLocationIt=this->HeaderLocationCache.find(cacheKey);
if (headerLocationIt!=this->HeaderLocationCache.end())
{
--- 180,185 ----
else
{
std::map<cmStdString, cmStdString>::iterator
! headerLocationIt=this->HeaderLocationCache.find(current.FileName);
if (headerLocationIt!=this->HeaderLocationCache.end())
{
***************
*** 215,221 ****
else
{
! tempPathStr += *i;
! tempPathStr+="/";
! tempPathStr+=current.FileName;
}
--- 199,205 ----
else
{
! tempPathStr += *i;
! tempPathStr+="/";
! tempPathStr+=current.FileName;
}
***************
*** 223,228 ****
if(cmSystemTools::FileExists(tempPathStr.c_str(), true))
{
! fullName = tempPathStr;
! HeaderLocationCache[cacheKey]=fullName;
break;
}
--- 207,212 ----
if(cmSystemTools::FileExists(tempPathStr.c_str(), true))
{
! fullName = tempPathStr;
! HeaderLocationCache[current.FileName]=fullName;
break;
}
More information about the Cmake-commits
mailing list