mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-25 14:09:26 +00:00
Replace all uses of std::unique_ptr with Catch::Detail::unique_ptr
Doing some benchmarking with ClangBuildAnalyzer suggests that compiling Catch2's `SelfTest` spends 10% of the time instantiating `std::unique_ptr` for some interface types required for registering and running tests. The lesser compilation overhead of `Catch::Detail::unique_ptr` should significantly reduce that time. The compiled implementation was also changed to use the custom impl, to avoid having to convert between using `std::unique_ptr` and `Catch::Detail::unique_ptr`. This will likely also improve the compile times of the implementation, but that is less important than improving compilation times of the user's TUs with tests.
This commit is contained in:
parent
41bbaa6d57
commit
1d1ccf8f3c
38 changed files with 141 additions and 125 deletions
|
@ -116,14 +116,15 @@ namespace {
|
|||
return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config );
|
||||
}
|
||||
|
||||
void TestRegistry::registerTest(std::unique_ptr<TestCaseInfo> testInfo, std::unique_ptr<ITestInvoker> testInvoker) {
|
||||
void TestRegistry::registerTest(Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker) {
|
||||
m_handles.emplace_back(testInfo.get(), testInvoker.get());
|
||||
m_infos.push_back(std::move(testInfo));
|
||||
m_viewed_test_infos.push_back(testInfo.get());
|
||||
m_owned_test_infos.push_back(std::move(testInfo));
|
||||
m_invokers.push_back(std::move(testInvoker));
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<TestCaseInfo>> const& TestRegistry::getAllInfos() const {
|
||||
return m_infos;
|
||||
std::vector<TestCaseInfo*> const& TestRegistry::getAllInfos() const {
|
||||
return m_viewed_test_infos;
|
||||
}
|
||||
|
||||
std::vector<TestCaseHandle> const& TestRegistry::getAllTests() const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue