Merge #13598: bench: fix incorrect behaviour in prevector.cpp

1fc605a8ae fix bench/prevector.cpp (Akio Nakamura)

Pull request description:

  This patch intends to fix some incorrect action of bench/prevector.cpp.

  1. PrevectorClear()
  2nd call of ```clear()``` should to operate t1 instead of t0.
  This patch changes t0 to t1.

  2. PREVECTOR_TEST()
  PREVECTOR_TEST macro should to call both
  ```PrevectorXX<nontrivial_t>(state)``` and ```PrevectorXX<trivial_t>(state)```
  by specific ```"name"``` which given by parameter instead of calling
  ```PrevectorResize<>()``` regardless of ```"name"```.
  This patch changes ```"PrevectorResize<"``` of this macro to
  ```"Prevector ## name<"```.

Tree-SHA512: d0498c6d627d7e96fc8ccfb329ca0be2641535b1ce1923d9b1fc720825f9bf4d7281dc8d5ae929038e37b3e625189af9807cb62e6d20933d73832a6dff4b5596
This commit is contained in:
MarcoFalke 2018-07-05 19:59:32 -11:00
commit 0212187fc6
No known key found for this signature in database
GPG key ID: D2EA4850E7528B25

View file

@ -42,7 +42,7 @@ static void PrevectorClear(benchmark::State& state)
t0.resize(28); t0.resize(28);
t0.clear(); t0.clear();
t1.resize(29); t1.resize(29);
t0.clear(); t1.clear();
} }
} }
} }
@ -64,11 +64,11 @@ static void PrevectorResize(benchmark::State& state)
#define PREVECTOR_TEST(name, nontrivops, trivops) \ #define PREVECTOR_TEST(name, nontrivops, trivops) \
static void Prevector ## name ## Nontrivial(benchmark::State& state) { \ static void Prevector ## name ## Nontrivial(benchmark::State& state) { \
PrevectorResize<nontrivial_t>(state); \ Prevector ## name<nontrivial_t>(state); \
} \ } \
BENCHMARK(Prevector ## name ## Nontrivial, nontrivops); \ BENCHMARK(Prevector ## name ## Nontrivial, nontrivops); \
static void Prevector ## name ## Trivial(benchmark::State& state) { \ static void Prevector ## name ## Trivial(benchmark::State& state) { \
PrevectorResize<trivial_t>(state); \ Prevector ## name<trivial_t>(state); \
} \ } \
BENCHMARK(Prevector ## name ## Trivial, trivops); BENCHMARK(Prevector ## name ## Trivial, trivops);