[cmake-developers] CMake is slow for project with hundred target and one command with large number of dependencies

Nicolas Desprès nicolas.despres at gmail.com
Wed Jul 24 05:55:03 EDT 2013


On Wed, Jul 24, 2013 at 11:29 AM, Stephen Kelly <steveire at gmail.com> wrote:

> Nicolas Desprès wrote:
>
> >>  +    UpdateOutputToSourceMap(outputs, file);
> >>
> >> is missing a 'this->', as per the style. There's a couple of repeats of
> >> that.
> >>
> > Done
>
> You seem to have missed this one.
>
> There are also other style issues.
>
> * Don't put an else after a return
> * Wrap single line blocks in {}
>
> Done. I hope I did them all.


>
> > That's said we can optimize further as I mentioned in my comment (
> >
>
> https://github.com/nicolasdespres/CMake/commit/59c871da8b00554812e93ba9c6e47d864424efb0#L0R2023
> ).
> > Do you have an opinion about it?
>
> Do I understand correctly that the issue is that OutputToSource values can
> be absolute or relative paths? That would be fixable by patching only
> UpdateOutputToSourceMap, right?
>
Not exactly. According to my tests only
cmMakefiles::GetSourceFileWithOutput's cname argument can be either
relative or absolute. When the mapping table is updated it always get an
absolute path. The previous code of GetSourceFileWithOutput() supported
both relative and absolute paths.

Here my test setup:

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index b68460d..d035e25 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1029,6 +1029,10 @@ void
 cmMakefile::UpdateOutputToSourceMap(const std::string& output,
                                     cmSourceFile* source)
 {
+  std::cout << "UPDATE: " << source->GetFullPath()
+            << " -> "
+            << output
+            << std::endl;
   this->OutputToSource[output] = source;
 }

@@ -2051,6 +2055,7 @@ cmMakefile::Compare::operator()(const std::string& s1,
 cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname)
 {
   std::string name = cname;
+  std::cout << "QUERY: " << name << std::endl;
   OutputToSourceMap::iterator o = this->OutputToSource.find(name);
   if (o != this->OutputToSource.end())
     {

Now when I run either:
ctest -VV -R ExportImport | tee /tmp/ImportExport-master.log
or
ctest -VV -R '^CustomCommand$' | tee /tmp/CustomCommand-master.log

I get some relative path in the QUERY debug message. That's reason why I
wrote the Compare functor because those tests were failing after my first
patch.

I hope it is clearer now.
Cheers,

-Nico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20130724/9a169987/attachment.html>


More information about the cmake-developers mailing list