diff options
author | Brad King <brad.king@kitware.com> | 2009-01-05 20:00:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-01-05 20:00:57 (GMT) |
commit | ed3bb743f4c2687187e1721c5ccc64dd06cc3db5 (patch) | |
tree | b29e9e94d7f4a770aa3fd4d4cf980b9ff78f699f /Source/cmSetPropertyCommand.cxx | |
parent | b5f3d4be61a9613abc7288f1cf31248412bfc50d (diff) | |
download | CMake-ed3bb743f4c2687187e1721c5ccc64dd06cc3db5.zip CMake-ed3bb743f4c2687187e1721c5ccc64dd06cc3db5.tar.gz CMake-ed3bb743f4c2687187e1721c5ccc64dd06cc3db5.tar.bz2 |
ENH: Improve test property speed with a map
Previously we stored a vector of tests to preserve their order.
Property set/get operations would do a linear search for matching tests.
This uses a map to efficiently look up tests while keeping the original
order with a vector for test file generation.
Diffstat (limited to 'Source/cmSetPropertyCommand.cxx')
-rw-r--r-- | Source/cmSetPropertyCommand.cxx | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 9d00e32..b683fe7 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -327,15 +327,14 @@ bool cmSetPropertyCommand::HandleSource(cmSourceFile* sf) //---------------------------------------------------------------------------- bool cmSetPropertyCommand::HandleTestMode() { - // Loop over all tests looking for matching names. - std::vector<cmTest*> const& tests = *this->Makefile->GetTests(); - for(std::vector<cmTest*>::const_iterator ti = tests.begin(); - ti != tests.end(); ++ti) - { - cmTest* test = *ti; - std::set<cmStdString>::iterator ni = - this->Names.find(test->GetName()); - if(ni != this->Names.end()) + // Look for tests with all names given. + std::set<cmStdString>::iterator next; + for(std::set<cmStdString>::iterator ni = this->Names.begin(); + ni != this->Names.end(); ni = next) + { + next = ni; + ++next; + if(cmTest* test = this->Makefile->GetTest(ni->c_str())) { if(this->HandleTest(test)) { |