diff options
| author | Martin Hořeňovský | 2020-03-08 14:04:20 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-03-08 14:04:35 +0100 |
| commit | 9de6eae6bbf2ccc9529cc266ceb0587b376c7e0d (patch) | |
| tree | ebb14766696cec0a3fa5d7fce22e47823ff58684 /src/catch2 | |
| parent | d1ffaf55a1653575a5a24da738ee777cdb85626f (diff) | |
| download | catch3-9de6eae6bbf2ccc9529cc266ceb0587b376c7e0d.tar.gz | |
ConsoleReporter no longer creates a string when writing time units
This is minor perf improvement only, but it is free and trivial.
Diffstat (limited to 'src/catch2')
| -rw-r--r-- | src/catch2/reporters/catch_reporter_console.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/catch2/reporters/catch_reporter_console.cpp b/src/catch2/reporters/catch_reporter_console.cpp index e091225e..f7b924ae 100644 --- a/src/catch2/reporters/catch_reporter_console.cpp +++ b/src/catch2/reporters/catch_reporter_console.cpp @@ -250,20 +250,20 @@ public: return static_cast<double>(m_inNanoseconds); } } - auto unitsAsString() const -> std::string { + StringRef unitsAsString() const { switch (m_units) { case Unit::Nanoseconds: - return "ns"; + return "ns"_sr; case Unit::Microseconds: - return "us"; + return "us"_sr; case Unit::Milliseconds: - return "ms"; + return "ms"_sr; case Unit::Seconds: - return "s"; + return "s"_sr; case Unit::Minutes: - return "m"; + return "m"_sr; default: - return "** internal error **"; + return "** internal error **"_sr; } } |