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.
This commit is contained in:
parent
302e2c0b06
commit
d36c15c3ca
18 changed files with 296 additions and 187 deletions
|
@ -38,6 +38,13 @@ namespace Catch {
|
|||
&& (std::memcmp( m_start, other.m_start, m_size ) == 0);
|
||||
}
|
||||
|
||||
bool StringRef::operator<(StringRef const& rhs) const noexcept {
|
||||
if (m_size < rhs.m_size) {
|
||||
return strncmp(m_start, rhs.m_start, m_size) <= 0;
|
||||
}
|
||||
return strncmp(m_start, rhs.m_start, rhs.m_size) < 0;
|
||||
}
|
||||
|
||||
auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& {
|
||||
return os.write(str.data(), str.size());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue