/*
- * Copyright 2015 Facebook, Inc.
+ * Copyright 2016 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-#include <stdint.h>
+#include <folly/Hash.h>
+#include <stdint.h>
#include <deque>
#include <random>
#include <string>
#include <vector>
+#include <glog/logging.h>
+
#include <folly/Benchmark.h>
#include <folly/Format.h>
-#include <folly/Hash.h>
#include <folly/Preprocessor.h>
-#include <gflags/gflags.h>
-#include <glog/logging.h>
+#include <folly/portability/GFlags.h>
namespace detail {
std::vector<uint8_t> randomBytes(size_t n) {
std::vector<uint8_t> ret(n);
std::default_random_engine rng(1729); // Deterministic seed.
- std::uniform_int_distribution<uint8_t> dist(0, 255);
+ std::uniform_int_distribution<uint16_t> dist(0, 255);
std::generate(ret.begin(), ret.end(), [&] () { return dist(rng); });
return ret;
}
static std::deque<std::string> names;
for (size_t i = 0; i < 16; ++i) {
- size_t k = 1 << i;
+ auto k = size_t(1) << i;
names.emplace_back(folly::sformat("{}: k=2^{}",name, i));
folly::addBenchmark(__FILE__, names.back().c_str(),
[=] (unsigned iters) {