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

summaryrefslogtreecommitdiffhomepage
path: root/docs/benchmarks.md
diff options
context:
space:
mode:
authorJoe Burzinski2019-11-18 22:22:38 -0600
committerMartin Hořeňovský2020-02-13 16:15:50 +0100
commit0fbf4f3e152e8fe9a41fa1a960ea3dac3cb76e59 (patch)
treed533f0a4066aab4cef66f4252d529454ab05a6cf /docs/benchmarks.md
parentad3f50bbc1ad66bf9ad5005d1a5f52eb6b28972f (diff)
downloadcatch3-0fbf4f3e152e8fe9a41fa1a960ea3dac3cb76e59.tar.gz
Fix wrong namespacing of benchmarking constructor helpers
Diffstat (limited to 'docs/benchmarks.md')
-rw-r--r--docs/benchmarks.md12
1 files changed, 5 insertions, 7 deletions
diff --git a/docs/benchmarks.md b/docs/benchmarks.md
index 6513cc2d..ccc4175b 100644
--- a/docs/benchmarks.md
+++ b/docs/benchmarks.md
@@ -164,7 +164,7 @@ Note that it is not possible to simply use the same instance for different runs
and resetting it between each run since that would pollute the measurements with
the resetting code.
-It is also possible to just provide an argument name to the simple `BENCHMARK` macro to get
+It is also possible to just provide an argument name to the simple `BENCHMARK` macro to get
the same semantics as providing a callable to `meter.measure` with `int` argument:
```c++
@@ -185,19 +185,17 @@ construct and destroy objects without dynamic allocation and in a way that lets
you measure construction and destruction separately.
```c++
-BENCHMARK_ADVANCED("construct")(Catch::Benchmark::Chronometer meter)
-{
+BENCHMARK_ADVANCED("construct")(Catch::Benchmark::Chronometer meter) {
std::vector<Catch::Benchmark::storage_for<std::string>> storage(meter.runs());
meter.measure([&](int i) { storage[i].construct("thing"); });
-})
+};
-BENCHMARK_ADVANCED("destroy", [](Catch::Benchmark::Chronometer meter)
-{
+BENCHMARK_ADVANCED("destroy")(Catch::Benchmark::Chronometer meter) {
std::vector<Catch::Benchmark::destructable_object<std::string>> storage(meter.runs());
for(auto&& o : storage)
o.construct("thing");
meter.measure([&](int i) { storage[i].destruct(); });
-})
+};
```
`Catch::Benchmark::storage_for<T>` objects are just pieces of raw storage suitable for `T`