diff options
| author | Martin Hořeňovský | 2019-11-07 12:39:07 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2019-11-14 10:53:12 +0100 |
| commit | d36c15c3caf96c2e751f4ad83a386c1fd047c2f6 (patch) | |
| tree | cba3faef17447ccfd3a2c9a7e751f8a52e2ae226 /include/internal/catch_test_spec.cpp | |
| parent | 302e2c0b06f131199b97ad33bdebacc359782ff0 (diff) | |
| download | catch3-d36c15c3caf96c2e751f4ad83a386c1fd047c2f6.tar.gz | |
Store tags in one big pre-allocated string and only work with refs
This should decrease the number of allocations before main is entered
significantly, but complicates the code somewhat in return.
Assuming I used `massif` right, doing just `SelfTest --list-tests`
went from 929 allocations at "Remove gcc-4.9 from the travis builds"
(2 commits up), to 614 allocations with this commit.
Diffstat (limited to 'include/internal/catch_test_spec.cpp')
| -rw-r--r-- | include/internal/catch_test_spec.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/internal/catch_test_spec.cpp b/include/internal/catch_test_spec.cpp index 0292673a..6c63d4ce 100644 --- a/include/internal/catch_test_spec.cpp +++ b/include/internal/catch_test_spec.cpp @@ -43,9 +43,11 @@ namespace Catch { {} bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const { - return std::find(begin(testCase.lcaseTags), - end(testCase.lcaseTags), - m_tag) != end(testCase.lcaseTags); + return std::find_if(begin(testCase.tags), + end(testCase.tags), + [&](Tag const& tag) { + return tag.lowerCased == m_tag; + }) != end(testCase.tags); } bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const { |