[Cmake-commits] [cmake-commits] alex committed cmDepends.cxx 1.18 1.19
cmake-commits at cmake.org
cmake-commits at cmake.org
Sat Sep 19 13:02:16 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv26367
Modified Files:
cmDepends.cxx
Log Message:
Minor optimization in dependency checking.
When reading the depend.internal file, check only once for every depender
whether it exists, instead of repeatedly in a loop for each dependee. Within
that function it can only change of the depender is removed. This is taken
care of.
This reduces the number of access() calls in kdelibs/khtml from 180000 to
90000 (i.e. 50%), and reduces the time for that (without the actual
scanning) from 0.3 s to 0.21 s on my system.
Alex
Index: cmDepends.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDepends.cxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -C 2 -d -r1.18 -r1.19
*** cmDepends.cxx 8 May 2008 14:09:14 -0000 1.18
--- cmDepends.cxx 19 Sep 2009 17:02:12 -0000 1.19
***************
*** 153,156 ****
--- 153,157 ----
// regenerated.
bool okay = true;
+ bool dependerExists = false;
while(internalDepends.getline(this->Dependee, this->MaxPath))
{
***************
*** 169,172 ****
--- 170,178 ----
{
memcpy(this->Depender, this->Dependee, len+1);
+ // Calling FileExists() for the depender here saves in many cases 50%
+ // of the calls to FileExists() further down in the loop. E.g. for
+ // kdelibs/khtml this reduces the number of calls from 184k down to 92k,
+ // or the time for cmake -E cmake_depends from 0.3 s down to 0.21 s.
+ dependerExists = cmSystemTools::FileExists(this->Depender);
continue;
}
***************
*** 199,203 ****
}
}
! else if(cmSystemTools::FileExists(depender))
{
// The dependee and depender both exist. Compare file times.
--- 205,209 ----
}
}
! else if(dependerExists)
{
// The dependee and depender both exist. Compare file times.
***************
*** 226,230 ****
// Remove the depender to be sure it is rebuilt.
! cmSystemTools::RemoveFile(depender);
}
}
--- 232,240 ----
// Remove the depender to be sure it is rebuilt.
! if (dependerExists)
! {
! cmSystemTools::RemoveFile(depender);
! dependerExists = false;
! }
}
}
More information about the Cmake-commits
mailing list