diff options
| author | Martin Hořeňovský | 2023-01-27 22:12:57 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2023-01-29 10:14:20 +0100 |
| commit | 43f02027e47310e200f20f5c3a1de6fe281e2f81 (patch) | |
| tree | d0a0f722915ee180eaed42d6d4fac553f758cee1 /tests/SelfTest/IntrospectiveTests | |
| parent | 906552f8c831d0dd1917484b53dd080537f19acd (diff) | |
| download | catch3-43f02027e47310e200f20f5c3a1de6fe281e2f81.tar.gz | |
Avoid allocations when looking for trackers
Now we delay allocating owning `NameAndLocation` instances until
we construct a new tracker (because a tracker's lifetime can be
significantly different from the underlying tracked-thing's name).
This saves 4239 allocations (436948 -> 432709) when running
`./tests/SelfTest -o /dev/null`, at some cost to code clarity
due to introducing a new ref type, `NameAndLocationRef`.
Diffstat (limited to 'tests/SelfTest/IntrospectiveTests')
| -rw-r--r-- | tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp b/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp index ac8be645..c13ec573 100644 --- a/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp @@ -14,8 +14,8 @@ using namespace Catch; namespace { -Catch::TestCaseTracking::NameAndLocation makeNAL( std::string const& name ) { - return Catch::TestCaseTracking::NameAndLocation( name, Catch::SourceLineInfo("",0) ); +Catch::TestCaseTracking::NameAndLocationRef makeNAL( StringRef name ) { + return Catch::TestCaseTracking::NameAndLocationRef( name, Catch::SourceLineInfo("",0) ); } } |