mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
ConsoleReporter no longer creates a string when writing time units
This is minor perf improvement only, but it is free and trivial.
This commit is contained in:
parent
d1ffaf55a1
commit
9de6eae6bb
@ -250,20 +250,20 @@ public:
|
|||||||
return static_cast<double>(m_inNanoseconds);
|
return static_cast<double>(m_inNanoseconds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto unitsAsString() const -> std::string {
|
StringRef unitsAsString() const {
|
||||||
switch (m_units) {
|
switch (m_units) {
|
||||||
case Unit::Nanoseconds:
|
case Unit::Nanoseconds:
|
||||||
return "ns";
|
return "ns"_sr;
|
||||||
case Unit::Microseconds:
|
case Unit::Microseconds:
|
||||||
return "us";
|
return "us"_sr;
|
||||||
case Unit::Milliseconds:
|
case Unit::Milliseconds:
|
||||||
return "ms";
|
return "ms"_sr;
|
||||||
case Unit::Seconds:
|
case Unit::Seconds:
|
||||||
return "s";
|
return "s"_sr;
|
||||||
case Unit::Minutes:
|
case Unit::Minutes:
|
||||||
return "m";
|
return "m"_sr;
|
||||||
default:
|
default:
|
||||||
return "** internal error **";
|
return "** internal error **"_sr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user