proxygen
|
#include <folly/Range.h>
#include <algorithm>
#include <iostream>
#include <random>
#include <string>
#include <folly/Benchmark.h>
#include <folly/container/Foreach.h>
Go to the source code of this file.
Functions | |
BENCHMARK (FindSingleCharMemchr, n) | |
BENCHMARK_RELATIVE (FindSingleCharRange, n) | |
BENCHMARK_DRAW_LINE () | |
template<class Func > | |
void | countHits (Func func, size_t n) |
template<class Func > | |
void | findFirstOfRange (StringPiece needles, Func func, size_t n) |
BENCHMARK (FindFirstOf1NeedlesBase, n) | |
BENCHMARK_RELATIVE (FindFirstOf1NeedlesNoSSE, n) | |
BENCHMARK_RELATIVE (FindFirstOf1NeedlesStd, n) | |
BENCHMARK_RELATIVE (FindFirstOf1NeedlesByteSet, n) | |
BENCHMARK_RELATIVE (FindFirstOf1NeedlesBitSet, n) | |
BENCHMARK (FindFirstOf2NeedlesBase, n) | |
BENCHMARK_RELATIVE (FindFirstOf2NeedlesNoSSE, n) | |
BENCHMARK_RELATIVE (FindFirstOf2NeedlesStd, n) | |
BENCHMARK_RELATIVE (FindFirstOf2NeedlesByteSet, n) | |
BENCHMARK_RELATIVE (FindFirstOf2NeedlesBitSet, n) | |
BENCHMARK (FindFirstOf4NeedlesBase, n) | |
BENCHMARK_RELATIVE (FindFirstOf4NeedlesNoSSE, n) | |
BENCHMARK_RELATIVE (FindFirstOf4NeedlesStd, n) | |
BENCHMARK_RELATIVE (FindFirstOf4NeedlesByteSet, n) | |
BENCHMARK_RELATIVE (FindFirstOf4NeedlesBitSet, n) | |
BENCHMARK (FindFirstOf8NeedlesBase, n) | |
BENCHMARK_RELATIVE (FindFirstOf8NeedlesNoSSE, n) | |
BENCHMARK_RELATIVE (FindFirstOf8NeedlesStd, n) | |
BENCHMARK_RELATIVE (FindFirstOf8NeedlesByteSet, n) | |
BENCHMARK_RELATIVE (FindFirstOf8NeedlesBitSet, n) | |
BENCHMARK (FindFirstOf16NeedlesBase, n) | |
BENCHMARK_RELATIVE (FindFirstOf16NeedlesNoSSE, n) | |
BENCHMARK_RELATIVE (FindFirstOf16NeedlesStd, n) | |
BENCHMARK_RELATIVE (FindFirstOf16NeedlesByteSet, n) | |
BENCHMARK_RELATIVE (FindFirstOf16NeedlesBitSet, n) | |
BENCHMARK (FindFirstOf32NeedlesBase, n) | |
BENCHMARK_RELATIVE (FindFirstOf32NeedlesNoSSE, n) | |
BENCHMARK_RELATIVE (FindFirstOf32NeedlesStd, n) | |
BENCHMARK_RELATIVE (FindFirstOf32NeedlesByteSet, n) | |
BENCHMARK_RELATIVE (FindFirstOf32NeedlesBitSet, n) | |
BENCHMARK (FindFirstOf64NeedlesBase, n) | |
BENCHMARK_RELATIVE (FindFirstOf64NeedlesNoSSE, n) | |
BENCHMARK_RELATIVE (FindFirstOf64NeedlesStd, n) | |
BENCHMARK_RELATIVE (FindFirstOf64NeedlesByteSet, n) | |
BENCHMARK_RELATIVE (FindFirstOf64NeedlesBitSet, n) | |
template<class Func > | |
void | findFirstOfRandom (Func func, size_t iters) |
BENCHMARK (FindFirstOfRandomBase, n) | |
BENCHMARK_RELATIVE (FindFirstOfRandomNoSSE, n) | |
BENCHMARK_RELATIVE (FindFirstOfRandomStd, n) | |
BENCHMARK_RELATIVE (FindFirstOfRandomByteSet, n) | |
BENCHMARK_RELATIVE (FindFirstOfRandomBitSet, n) | |
BENCHMARK (CountDelimsBase, n) | |
BENCHMARK_RELATIVE (CountDelimsNoSSE, n) | |
BENCHMARK_RELATIVE (CountDelimsStd, n) | |
BENCHMARK_RELATIVE (CountDelimsByteSet, n) | |
BENCHMARK_RELATIVE (CountDelimsBitSet, n) | |
BENCHMARK (FindFirstOfOffsetRange, n) | |
int | main (int argc, char **argv) |
Variables | |
const string | delims1 = "b" |
const string | delims2 = "bc" |
const string | delims4 = "bcde" |
const string | delims8 = "0123456b" |
const string | delims16 = "0123456789bcdefg" |
const string | delims32 = "!bcdefghijklmnopqrstuvwxyz_012345" |
const string | delims64 |
BENCHMARK | ( | FindSingleCharMemchr | , |
n | |||
) |
Definition at line 116 of file RangeFindBenchmark.cpp.
References folly::doNotOptimizeAway(), folly::Range< Iter >::find(), FOR_EACH_RANGE, and i.
BENCHMARK | ( | FindFirstOf1NeedlesBase | , |
n | |||
) |
Definition at line 164 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of().
BENCHMARK | ( | FindFirstOf2NeedlesBase | , |
n | |||
) |
Definition at line 188 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of().
BENCHMARK | ( | FindFirstOf4NeedlesBase | , |
n | |||
) |
Definition at line 212 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of().
BENCHMARK | ( | FindFirstOf8NeedlesBase | , |
n | |||
) |
Definition at line 236 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of().
BENCHMARK | ( | FindFirstOf16NeedlesBase | , |
n | |||
) |
Definition at line 260 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of().
BENCHMARK | ( | FindFirstOf32NeedlesBase | , |
n | |||
) |
Definition at line 284 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of().
BENCHMARK | ( | FindFirstOf64NeedlesBase | , |
n | |||
) |
Definition at line 310 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of().
BENCHMARK | ( | FindFirstOfRandomBase | , |
n | |||
) |
Definition at line 341 of file RangeFindBenchmark.cpp.
References findFirstOfRandom(), and folly::detail::qfind_first_byte_of().
BENCHMARK | ( | CountDelimsBase | , |
n | |||
) |
Definition at line 363 of file RangeFindBenchmark.cpp.
References countHits(), and folly::detail::qfind_first_byte_of().
BENCHMARK | ( | FindFirstOfOffsetRange | , |
n | |||
) |
Definition at line 385 of file RangeFindBenchmark.cpp.
References folly::BENCHMARK_DRAW_LINE(), folly::doNotOptimizeAway(), folly::Range< Iter >::find_first_of(), FOR_EACH_RANGE, i, and folly::Range< Iter >::size().
BENCHMARK_DRAW_LINE | ( | ) |
BENCHMARK_RELATIVE | ( | FindSingleCharRange | , |
n | |||
) |
Definition at line 125 of file RangeFindBenchmark.cpp.
References folly::BENCHMARK_DRAW_LINE(), c, folly::doNotOptimizeAway(), folly::Range< Iter >::find(), FOR_EACH_RANGE, i, and needle.
BENCHMARK_RELATIVE | ( | FindFirstOf1NeedlesNoSSE | , |
n | |||
) |
Definition at line 168 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_nosse().
BENCHMARK_RELATIVE | ( | FindFirstOf1NeedlesStd | , |
n | |||
) |
Definition at line 172 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_std().
BENCHMARK_RELATIVE | ( | FindFirstOf1NeedlesByteSet | , |
n | |||
) |
Definition at line 176 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_byteset().
BENCHMARK_RELATIVE | ( | FindFirstOf1NeedlesBitSet | , |
n | |||
) |
Definition at line 180 of file RangeFindBenchmark.cpp.
References folly::BENCHMARK_DRAW_LINE(), findFirstOfRange(), and folly::detail::qfind_first_byte_of_bitset().
BENCHMARK_RELATIVE | ( | FindFirstOf2NeedlesNoSSE | , |
n | |||
) |
Definition at line 192 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_nosse().
BENCHMARK_RELATIVE | ( | FindFirstOf2NeedlesStd | , |
n | |||
) |
Definition at line 196 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_std().
BENCHMARK_RELATIVE | ( | FindFirstOf2NeedlesByteSet | , |
n | |||
) |
Definition at line 200 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_byteset().
BENCHMARK_RELATIVE | ( | FindFirstOf2NeedlesBitSet | , |
n | |||
) |
Definition at line 204 of file RangeFindBenchmark.cpp.
References folly::BENCHMARK_DRAW_LINE(), findFirstOfRange(), and folly::detail::qfind_first_byte_of_bitset().
BENCHMARK_RELATIVE | ( | FindFirstOf4NeedlesNoSSE | , |
n | |||
) |
Definition at line 216 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_nosse().
BENCHMARK_RELATIVE | ( | FindFirstOf4NeedlesStd | , |
n | |||
) |
Definition at line 220 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_std().
BENCHMARK_RELATIVE | ( | FindFirstOf4NeedlesByteSet | , |
n | |||
) |
Definition at line 224 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_byteset().
BENCHMARK_RELATIVE | ( | FindFirstOf4NeedlesBitSet | , |
n | |||
) |
Definition at line 228 of file RangeFindBenchmark.cpp.
References folly::BENCHMARK_DRAW_LINE(), findFirstOfRange(), and folly::detail::qfind_first_byte_of_bitset().
BENCHMARK_RELATIVE | ( | FindFirstOf8NeedlesNoSSE | , |
n | |||
) |
Definition at line 240 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_nosse().
BENCHMARK_RELATIVE | ( | FindFirstOf8NeedlesStd | , |
n | |||
) |
Definition at line 244 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_std().
BENCHMARK_RELATIVE | ( | FindFirstOf8NeedlesByteSet | , |
n | |||
) |
Definition at line 248 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_byteset().
BENCHMARK_RELATIVE | ( | FindFirstOf8NeedlesBitSet | , |
n | |||
) |
Definition at line 252 of file RangeFindBenchmark.cpp.
References folly::BENCHMARK_DRAW_LINE(), findFirstOfRange(), and folly::detail::qfind_first_byte_of_bitset().
BENCHMARK_RELATIVE | ( | FindFirstOf16NeedlesNoSSE | , |
n | |||
) |
Definition at line 264 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_nosse().
BENCHMARK_RELATIVE | ( | FindFirstOf16NeedlesStd | , |
n | |||
) |
Definition at line 268 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_std().
BENCHMARK_RELATIVE | ( | FindFirstOf16NeedlesByteSet | , |
n | |||
) |
Definition at line 272 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_byteset().
BENCHMARK_RELATIVE | ( | FindFirstOf16NeedlesBitSet | , |
n | |||
) |
Definition at line 276 of file RangeFindBenchmark.cpp.
References folly::BENCHMARK_DRAW_LINE(), findFirstOfRange(), and folly::detail::qfind_first_byte_of_bitset().
BENCHMARK_RELATIVE | ( | FindFirstOf32NeedlesNoSSE | , |
n | |||
) |
Definition at line 288 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_nosse().
BENCHMARK_RELATIVE | ( | FindFirstOf32NeedlesStd | , |
n | |||
) |
Definition at line 292 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_std().
BENCHMARK_RELATIVE | ( | FindFirstOf32NeedlesByteSet | , |
n | |||
) |
Definition at line 296 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_byteset().
BENCHMARK_RELATIVE | ( | FindFirstOf32NeedlesBitSet | , |
n | |||
) |
Definition at line 300 of file RangeFindBenchmark.cpp.
References folly::BENCHMARK_DRAW_LINE(), findFirstOfRange(), and folly::detail::qfind_first_byte_of_bitset().
BENCHMARK_RELATIVE | ( | FindFirstOf64NeedlesNoSSE | , |
n | |||
) |
Definition at line 314 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_nosse().
BENCHMARK_RELATIVE | ( | FindFirstOf64NeedlesStd | , |
n | |||
) |
Definition at line 318 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_std().
BENCHMARK_RELATIVE | ( | FindFirstOf64NeedlesByteSet | , |
n | |||
) |
Definition at line 322 of file RangeFindBenchmark.cpp.
References findFirstOfRange(), and folly::detail::qfind_first_byte_of_byteset().
BENCHMARK_RELATIVE | ( | FindFirstOf64NeedlesBitSet | , |
n | |||
) |
Definition at line 326 of file RangeFindBenchmark.cpp.
References folly::BENCHMARK_DRAW_LINE(), findFirstOfRange(), and folly::detail::qfind_first_byte_of_bitset().
BENCHMARK_RELATIVE | ( | FindFirstOfRandomNoSSE | , |
n | |||
) |
Definition at line 345 of file RangeFindBenchmark.cpp.
References findFirstOfRandom(), and folly::detail::qfind_first_byte_of_nosse().
BENCHMARK_RELATIVE | ( | FindFirstOfRandomStd | , |
n | |||
) |
Definition at line 349 of file RangeFindBenchmark.cpp.
References findFirstOfRandom(), and folly::detail::qfind_first_byte_of_std().
BENCHMARK_RELATIVE | ( | FindFirstOfRandomByteSet | , |
n | |||
) |
Definition at line 353 of file RangeFindBenchmark.cpp.
References findFirstOfRandom(), and folly::detail::qfind_first_byte_of_byteset().
BENCHMARK_RELATIVE | ( | FindFirstOfRandomBitSet | , |
n | |||
) |
Definition at line 357 of file RangeFindBenchmark.cpp.
References folly::BENCHMARK_DRAW_LINE(), findFirstOfRandom(), and folly::detail::qfind_first_byte_of_bitset().
BENCHMARK_RELATIVE | ( | CountDelimsNoSSE | , |
n | |||
) |
Definition at line 367 of file RangeFindBenchmark.cpp.
References countHits(), and folly::detail::qfind_first_byte_of_nosse().
BENCHMARK_RELATIVE | ( | CountDelimsStd | , |
n | |||
) |
Definition at line 371 of file RangeFindBenchmark.cpp.
References countHits(), and folly::detail::qfind_first_byte_of_std().
BENCHMARK_RELATIVE | ( | CountDelimsByteSet | , |
n | |||
) |
Definition at line 375 of file RangeFindBenchmark.cpp.
References countHits(), and folly::detail::qfind_first_byte_of_byteset().
BENCHMARK_RELATIVE | ( | CountDelimsBitSet | , |
n | |||
) |
Definition at line 379 of file RangeFindBenchmark.cpp.
References folly::BENCHMARK_DRAW_LINE(), countHits(), and folly::detail::qfind_first_byte_of_bitset().
void countHits | ( | Func | func, |
size_t | n | ||
) |
Definition at line 139 of file RangeFindBenchmark.cpp.
References c, folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, and folly::Range< const char * >::npos.
Referenced by BENCHMARK(), and BENCHMARK_RELATIVE().
void findFirstOfRandom | ( | Func | func, |
size_t | iters | ||
) |
Definition at line 333 of file RangeFindBenchmark.cpp.
References folly::doNotOptimizeAway(), and i.
Referenced by BENCHMARK(), and BENCHMARK_RELATIVE().
void findFirstOfRange | ( | StringPiece | needles, |
Func | func, | ||
size_t | n | ||
) |
Definition at line 153 of file RangeFindBenchmark.cpp.
References folly::doNotOptimizeAway(), FOR_EACH_RANGE, and i.
Referenced by BENCHMARK(), and BENCHMARK_RELATIVE().
int main | ( | int | argc, |
char ** | argv | ||
) |
const string delims1 = "b" |
Definition at line 162 of file RangeFindBenchmark.cpp.
const string delims16 = "0123456789bcdefg" |
Definition at line 258 of file RangeFindBenchmark.cpp.
const string delims2 = "bc" |
Definition at line 186 of file RangeFindBenchmark.cpp.
const string delims32 = "!bcdefghijklmnopqrstuvwxyz_012345" |
Definition at line 282 of file RangeFindBenchmark.cpp.
const string delims4 = "bcde" |
Definition at line 210 of file RangeFindBenchmark.cpp.
const string delims64 |
Definition at line 306 of file RangeFindBenchmark.cpp.
const string delims8 = "0123456b" |
Definition at line 234 of file RangeFindBenchmark.cpp.