Changeset View
Changeset View
Standalone View
Standalone View
src/bench/checkqueue.cpp
Show All 20 Lines | |||||
// This Benchmark tests the CheckQueue with a slightly realistic workload, where | // This Benchmark tests the CheckQueue with a slightly realistic workload, where | ||||
// checks all contain a prevector that is indirect 50% of the time and there is | // checks all contain a prevector that is indirect 50% of the time and there is | ||||
// a little bit of work done between calls to Add. | // a little bit of work done between calls to Add. | ||||
static void CCheckQueueSpeedPrevectorJob(benchmark::State &state) { | static void CCheckQueueSpeedPrevectorJob(benchmark::State &state) { | ||||
struct PrevectorJob { | struct PrevectorJob { | ||||
prevector<PREVECTOR_SIZE, uint8_t> p; | prevector<PREVECTOR_SIZE, uint8_t> p; | ||||
PrevectorJob() {} | PrevectorJob() {} | ||||
PrevectorJob(FastRandomContext &insecure_rand) { | explicit PrevectorJob(FastRandomContext &insecure_rand) { | ||||
p.resize(insecure_rand.randrange(PREVECTOR_SIZE * 2)); | p.resize(insecure_rand.randrange(PREVECTOR_SIZE * 2)); | ||||
} | } | ||||
bool operator()() { return true; } | bool operator()() { return true; } | ||||
void swap(PrevectorJob &x) { p.swap(x.p); }; | void swap(PrevectorJob &x) { p.swap(x.p); }; | ||||
}; | }; | ||||
CCheckQueue<PrevectorJob> queue{QUEUE_BATCH_SIZE}; | CCheckQueue<PrevectorJob> queue{QUEUE_BATCH_SIZE}; | ||||
boost::thread_group tg; | boost::thread_group tg; | ||||
for (auto x = 0; x < std::max(MIN_CORES, GetNumCores()); ++x) { | for (auto x = 0; x < std::max(MIN_CORES, GetNumCores()); ++x) { | ||||
Show All 21 Lines |