14#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 5
15#define IS_TRIVIALLY_CONSTRUCTIBLE std::has_trivial_default_constructor
17#define IS_TRIVIALLY_CONSTRUCTIBLE std::is_trivially_default_constructible
25static_assert(!IS_TRIVIALLY_CONSTRUCTIBLE<nontrivial_t>::value,
26 "expected nontrivial_t to not be trivially constructible");
29static_assert(IS_TRIVIALLY_CONSTRUCTIBLE<trivial_t>::value,
30 "expected trivial_t to be trivially constructible");
33 bench.batch(2).run([&] {
44 bench.batch(2).run([&] {
55 bench.batch(4).run([&] {
68 for (
auto x = 0; x < 900; ++x) {
72 for (
auto x = 0; x < 101; ++x) {
75 bench.batch(1000).run([&] {
77 for (
auto x = 0; x < 1000; ++x) {
87 std::vector<prevector<28, T>>
vec;
88 for (
size_t i = 0; i < 260; ++i) {
97 std::vector<prevector<28, T>>
vec;
98 for (
size_t i = 0; i < 260; ++i) {
100 vec.emplace_back(29, T{});
105#define PREVECTOR_TEST(name) \
106 static void Prevector##name##Nontrivial(benchmark::Bench &bench) { \
107 Prevector##name<nontrivial_t>(bench); \
109 BENCHMARK(Prevector##name##Nontrivial); \
110 static void Prevector##name##Trivial(benchmark::Bench &bench) { \
111 Prevector##name<trivial_t>(bench); \
113 BENCHMARK(Prevector##name##Trivial);
Double ended buffer combining vector and stream-like interfaces.
Main entry point to nanobench's benchmarking facility.
Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without h...
void resize(size_type new_size)
static void PrevectorFillVectorIndirect(benchmark::Bench &bench)
static void PrevectorResize(benchmark::Bench &bench)
static void PrevectorFillVectorDirect(benchmark::Bench &bench)
static void PrevectorDestructor(benchmark::Bench &bench)
static void PrevectorClear(benchmark::Bench &bench)
#define PREVECTOR_TEST(name)
static void PrevectorDeserialize(benchmark::Bench &bench)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
SERIALIZE_METHODS(nontrivial_t, obj)