proxygen
FBVectorBenchmarks.cpp.h File Reference

Go to the source code of this file.

Functions

 BENCHMARK (BENCHFUN(zzInitRNG))
 
 BENCHMARK (BENCHFUN(defaultCtor), iters)
 
void BENCHFUN() sizeCtor (int iters, int size)
 
void BENCHFUN() fillCtor (int iters, int size)
 
void BENCHFUN() reserve (int iters, int size)
 
void BENCHFUN() insertFront (int iters, int initialSize)
 
void BENCHFUN() pushBack (int iters, int initialSize)
 

Function Documentation

BENCHMARK ( BENCHFUN(zzInitRNG)  )

This file is supposed to be included from within FBVectorBenchmark. Do not use otherwise.

Definition at line 22 of file FBVectorBenchmarks.cpp.h.

References seed.

22  {
23  srand(seed);
24 }
static const int seed
BENCHMARK ( BENCHFUN(defaultCtor ,
iters   
)

Definition at line 26 of file FBVectorBenchmarks.cpp.h.

References folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, v, and VECTOR.

26  {
27  FOR_EACH_RANGE (i, 0, iters) {
28  VECTOR v;
30  }
31 }
auto v
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
#define VECTOR
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
void BENCHFUN() fillCtor ( int  iters,
int  size 
)

Definition at line 43 of file FBVectorBenchmarks.cpp.h.

References BENCHFUN, BENCHMARK_PARAM, folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, v, and VECTOR.

43  {
44  FOR_EACH_RANGE (i, 0, iters) {
45  VECTOR v(size_t(size), randomObject<VECTOR::value_type>());
47  }
48 }
auto v
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
#define VECTOR
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
void BENCHFUN() insertFront ( int  iters,
int  initialSize 
)

Definition at line 66 of file FBVectorBenchmarks.cpp.h.

References BENCHFUN, BENCHMARK_PARAM, FOR_EACH_RANGE, i, v, and VECTOR.

66  {
67  BenchmarkSuspender braces;
68  auto const obj = randomObject<VECTOR::value_type>();
69  VECTOR v(initialSize, obj);
70  braces.dismissing([&]() {
71  FOR_EACH_RANGE (i, 0, iters) { v.insert(v.begin(), obj); }
72  });
73 }
auto v
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
#define VECTOR
void BENCHFUN() pushBack ( int  iters,
int  initialSize 
)

Definition at line 82 of file FBVectorBenchmarks.cpp.h.

References BENCHFUN, BENCHMARK_PARAM, FOR_EACH_RANGE, i, v, and VECTOR.

82  {
83  BenchmarkSuspender braces;
84  auto const obj = randomObject<VECTOR::value_type>();
85  VECTOR v(initialSize, obj);
86  braces.dismissing([&]() {
87  FOR_EACH_RANGE (i, 0, iters) { v.push_back(obj); }
88  });
89 }
auto v
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
#define VECTOR
void BENCHFUN() reserve ( int  iters,
int  size 
)

Definition at line 54 of file FBVectorBenchmarks.cpp.h.

References BENCHFUN, BENCHMARK_PARAM, FOR_EACH_RANGE, i, random(), folly::size(), v, and VECTOR.

Referenced by folly::fbstring_core< Char >::expandNoinit(), and folly::basic_fbstring< E, T, A, Storage >::getlineImpl().

54  {
55  auto const obj = randomObject<VECTOR::value_type>();
56  FOR_EACH_RANGE (i, 0, iters) {
57  VECTOR v(random(0U, 1U), obj);
58  v.reserve(size);
59  }
60 }
Integral2 random(Integral1 low, Integral2 up)
auto v
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
#define VECTOR
void BENCHFUN() sizeCtor ( int  iters,
int  size 
)

Definition at line 33 of file FBVectorBenchmarks.cpp.h.

References BENCHFUN, BENCHMARK_PARAM, folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, folly::size(), v, and VECTOR.

33  {
34  FOR_EACH_RANGE (i, 0, iters) {
35  VECTOR v(size);
37  }
38 }
auto v
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
#define VECTOR
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258