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:
Martin Hořeňovský 2020-03-08 14:04:20 +01:00
parent d1ffaf55a1
commit 9de6eae6bb
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -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;
} }
} }