Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2023-01-28 21:40:51 +0100
committerMartin Hořeňovský2023-01-28 21:40:59 +0100
commit356dfc14391183aef80af7f23fe2297485311ae4 (patch)
tree85eb602d0711f63295abfba4de1b15e051534522
parente5d1eb757fe399ff312d837a318dcf17b495d32e (diff)
downloadcatch3-356dfc14391183aef80af7f23fe2297485311ae4.tar.gz
Move name and sample analysis in benchmarks into BenchmarkStats
This always saves 1 allocation per benchmark, and another two allocations if the benchmark name is longer than the SSO buffer.
-rw-r--r--src/catch2/benchmark/catch_benchmark.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/catch2/benchmark/catch_benchmark.hpp b/src/catch2/benchmark/catch_benchmark.hpp
index a2d5c3ea..1cf10be6 100644
--- a/src/catch2/benchmark/catch_benchmark.hpp
+++ b/src/catch2/benchmark/catch_benchmark.hpp
@@ -64,7 +64,7 @@ namespace Catch {
});
BenchmarkInfo info {
- name,
+ CATCH_MOVE(name),
plan.estimated_duration.count(),
plan.iterations_per_sample,
cfg->benchmarkSamples(),
@@ -80,7 +80,7 @@ namespace Catch {
});
auto analysis = Detail::analyse(*cfg, env, samples.begin(), samples.end());
- BenchmarkStats<FloatDuration<Clock>> stats{ info, analysis.samples, analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance };
+ BenchmarkStats<FloatDuration<Clock>> stats{ CATCH_MOVE(info), CATCH_MOVE(analysis.samples), analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance };
getResultCapture().benchmarkEnded(stats);
} CATCH_CATCH_ANON (TestFailureException) {
getResultCapture().benchmarkFailed("Benchmark failed due to failed assertion"_sr);