diff --git a/AUTHORS b/AUTHORS index 15418631c3..c5e5c0c497 100644 --- a/AUTHORS +++ b/AUTHORS @@ -44,6 +44,7 @@ Ori Livneh Paul Redmond Radoslav Yovchev Roman Lebedev +Sayan Bhattacharjee Shuo Chen Steinar H. Gunderson Stripe, Inc. diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 167165f469..5be6dc48cf 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -65,6 +65,7 @@ Raul Marin Ray Glover Robert Guo Roman Lebedev +Sayan Bhattacharjee Shuo Chen Tobias Ulvgård Tom Madams diff --git a/README.md b/README.md index ebbbf158de..450a1b283e 100644 --- a/README.md +++ b/README.md @@ -422,6 +422,22 @@ BENCHMARK(BM_memcpy)->RangeMultiplier(2)->Range(8, 8<<10); ``` Now arguments generated are [ 8, 16, 32, 64, 128, 256, 512, 1024, 2k, 4k, 8k ]. +The preceding code shows a method of defining a sparse range. The following +example shows a method of defining a dense range. It is then used to benchmark +the performance of `std::vector` initialization for uniformly increasing sizes. + +```c++ +static void BM_DenseRange(benchmark::State& state) { + for(auto _ : state) { + std::vector v(state.range(0), state.range(0)); + benchmark::DoNotOptimize(v.data()); + benchmark::ClobberMemory(); + } +} +BENCHMARK(BM_DenseRange)->DenseRange(0, 1024, 128); +``` +Now arguments generated are [ 0, 128, 256, 384, 512, 640, 768, 896, 1024 ]. + You might have a benchmark that depends on two or more inputs. For example, the following code defines a family of benchmarks for measuring the speed of set insertion.