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/cmGetPropertyCommand.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/cmGetPropertyCommand.cxx')
-rw-r--r-- | Source/cmGetPropertyCommand.cxx | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index c110161..93c724a 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -328,15 +328,9 @@ bool cmGetPropertyCommand::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) + if(cmTest* test = this->Makefile->GetTest(this->Name.c_str())) { - cmTest* test = *ti; - if(test->GetName() == this->Name) - { - return this->StoreResult(test->GetProperty(this->PropertyName.c_str())); - } + return this->StoreResult(test->GetProperty(this->PropertyName.c_str())); } // If not found it is an error. |