浏览代码

Add 'main.cpp'

master
Archivist 2 年前
父节点
当前提交
cad26409f0
共有 1 个文件被更改,包括 55 次插入0 次删除
  1. +55
    -0
      main.cpp

+ 55
- 0
main.cpp 查看文件

@ -0,0 +1,55 @@
#include <iostream>
#include "ChaPRNG.h"
#include <benchmark/benchmark.h>
#include <chrono>
#include <random>
using namespace std::chrono_literals;
template<int T, bool u, bool v>
static void PRNGBuild(benchmark::State& state) {
std::random_device dev;
std::array<uint32_t,12> seed{
dev(),dev(),dev(),dev(),
dev(),dev(),dev(),dev(),
dev(),dev(),dev(),dev()
};
ChaPRNG<T,u,v> prng(seed);
for(auto _ : state)
prng();
}
BENCHMARK(PRNGBuild<8, false, false>);
BENCHMARK(PRNGBuild<12, false, false>);
BENCHMARK(PRNGBuild<16, false, false>);
BENCHMARK(PRNGBuild<20, false, false>);
BENCHMARK(PRNGBuild<8, true, false>);
BENCHMARK(PRNGBuild<12, true, false>);
BENCHMARK(PRNGBuild<16, true, false>);
BENCHMARK(PRNGBuild<20, true, false>);
BENCHMARK(PRNGBuild<8, false, true>);
BENCHMARK(PRNGBuild<12, false, true>);
BENCHMARK(PRNGBuild<16, false, true>);
BENCHMARK(PRNGBuild<20, false, true>);
BENCHMARK(PRNGBuild<4, true, true>);
BENCHMARK(PRNGBuild<6, true, true>);
BENCHMARK(PRNGBuild<8, true, true>);
BENCHMARK(PRNGBuild<12, true, true>);
BENCHMARK(PRNGBuild<16, true, true>);
BENCHMARK(PRNGBuild<20, true, true>);
static void std_mtPRNGBuild(benchmark::State& state) {
std::random_device dev;
std::mt19937 prng(dev());
for(auto _ : state)
prng();
}
BENCHMARK(std_mtPRNGBuild);
BENCHMARK_MAIN();

正在加载...
取消
保存