Changeset View
Changeset View
Standalone View
Standalone View
src/bench/prevector.cpp
// Copyright (c) 2015-2017 The Bitcoin Core developers | // Copyright (c) 2015-2017 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <compat.h> | #include <compat.h> | ||||
#include <prevector.h> | #include <prevector.h> | ||||
#include <bench/bench.h> | #include <bench/bench.h> | ||||
struct nontrivial_t { | struct nontrivial_t { | ||||
int x; | int x; | ||||
nontrivial_t() : x(-1) {} | nontrivial_t() : x(-1) {} | ||||
}; | }; | ||||
static_assert(!IS_TRIVIALLY_CONSTRUCTIBLE<nontrivial_t>::value, | static_assert(!IS_TRIVIALLY_CONSTRUCTIBLE<nontrivial_t>::value, | ||||
"expected nontrivial_t to not be trivially constructible"); | "expected nontrivial_t to not be trivially constructible"); | ||||
typedef unsigned char trivial_t; | typedef uint8_t trivial_t; | ||||
static_assert(IS_TRIVIALLY_CONSTRUCTIBLE<trivial_t>::value, | static_assert(IS_TRIVIALLY_CONSTRUCTIBLE<trivial_t>::value, | ||||
"expected trivial_t to be trivially constructible"); | "expected trivial_t to be trivially constructible"); | ||||
template <typename T> static void PrevectorDestructor(benchmark::State &state) { | template <typename T> static void PrevectorDestructor(benchmark::State &state) { | ||||
while (state.KeepRunning()) { | while (state.KeepRunning()) { | ||||
for (auto x = 0; x < 1000; ++x) { | for (auto x = 0; x < 1000; ++x) { | ||||
prevector<28, T> t0; | prevector<28, T> t0; | ||||
prevector<28, T> t1; | prevector<28, T> t1; | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |