29 using namespace folly;
32 for (
unsigned long i = 0;
i < iters; ++
i) {
41 for (
unsigned long i = 0;
i < iters; ++
i) {
50 for (
unsigned long i = 0;
i < iters; ++
i) {
59 void testPartialLoadUnaligned(F
f,
size_t iters) {
60 constexpr
size_t kBufSize = 32;
62 std::vector<char> buf;
64 buf.resize(kBufSize + 7);
70 for (
size_t i = 0;
i < iters; ++
i) {
72 auto pos = ret % kBufSize;
73 ret =
f(buf.data() + pos,
i % 8);
84 uint64_t partialLoadUnalignedSwitch(
const char* p,
size_t l) {
90 r =
static_cast<uint64_t>(folly::loadUnaligned<uint32_t>(p + 3)) << 24;
93 r |=
static_cast<uint64_t>(folly::loadUnaligned<uint16_t>(p + 1)) << 8;
100 r =
static_cast<uint64_t>(folly::loadUnaligned<uint16_t>(p + 4)) << 32;
103 r |= folly::loadUnaligned<uint32_t>(p);
107 r =
static_cast<uint64_t>(folly::loadUnaligned<uint32_t>(p + 4)) << 32;
112 r = folly::loadUnaligned<uint16_t>(p);
127 testPartialLoadUnaligned(folly::partialLoadUnaligned<uint64_t>, iters);
131 testPartialLoadUnaligned(
132 [](
const char* p,
size_t l) {
143 testPartialLoadUnaligned(partialLoadUnalignedSwitch, iters);
147 gflags::ParseCommandLineFlags(&argc, &argv,
true);
constexpr T nextPowTwo(T const v)
#define BENCHMARK_SUSPEND
—— Concurrent Priority Queue Implementation ——
constexpr bool isPowTwo(T const v)
int main(int argc, char *argv[])
BENCHMARK(fbFollyGlobalBenchmarkBaseline)
FOLLY_ALWAYS_INLINE void assume(bool cond)
#define FOLLY_FALLTHROUGH
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type