36 return n <= 1 ? 1 :
fib(n - 1) *
fib(n - 2);
40 auto result =
seq(1, (
int)n) |
map([](
int) {
return fib(kFib); }) |
sum;
50 seq(1, (
int)(n * kNumThreads))
60 std::vector<std::thread> workers;
61 workers.reserve(kNumThreads);
63 auto result =
seq(1, (
int)n) |
map([](
int) {
return fib(kFib); }) |
sum;
67 workers.push_back(std::thread(fn));
69 for (
auto& w : workers) {
89 gflags::ParseCommandLineFlags(&argc, &argv,
true);
Gen seq(Value first, Value last)
static size_t const kNumThreads
constexpr detail::Sum sum
std::vector< std::thread::id > threads
BENCHMARK_RELATIVE(FibSumPmap, n)
Map map(Predicate pred=Predicate())
int main(int argc, char *argv[])
DEFINE_int32(threads, std::max(1,(int32_t) sysconf(_SC_NPROCESSORS_CONF)/2),"Num threads.")
BENCHMARK(fbFollyGlobalBenchmarkBaseline)
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
PMap pmap(Predicate pred=Predicate(), size_t nThreads=0)