mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	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`.
This commit is contained in:
		| @@ -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) ); | ||||
| } | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský