proxygen
ConvBenchmark.cpp File Reference
#include <folly/Conv.h>
#include <boost/lexical_cast.hpp>
#include <folly/Benchmark.h>
#include <folly/CppAttributes.h>
#include <folly/container/Foreach.h>
#include <array>
#include <limits>
#include <stdexcept>

Go to the source code of this file.

Classes

struct  StringIdenticalToBM< String >
 
struct  StringVariadicToBM< String >
 

Namespaces

 folly
 —— Concurrent Priority Queue Implementation ——
 
 folly::conv_bench_detail
 

Macros

#define FOLLY_RANGE_CHECK_TO_STRING(x)   std::to_string(x)
 
#define DEFINE_BENCHMARK_GROUP(n)
 
#define DEFINE_BENCHMARK_GROUP(n)
 
#define DEFINE_BENCHMARK_GROUP(n)
 
#define DEFINE_BENCHMARK_GROUP(T, n)
 
#define STRING_TO_TYPE_BENCHMARK(type, name, pass, fail)
 
#define PTR_PAIR_TO_INT_BENCHMARK(type, name, pass, fail)
 
#define ARITH_TO_ARITH_BENCHMARK(type, name, pass, fail)
 
#define INT_TO_ARITH_BENCHMARK(type, name, pass, fail)   ARITH_TO_ARITH_BENCHMARK(type, intTo##name, pass, fail)
 
#define FLOAT_TO_ARITH_BENCHMARK(type, name, pass, fail)   ARITH_TO_ARITH_BENCHMARK(type, floatTo##name, pass, fail)
 

Functions

static int64_t handwrittenAtoi (const char *start, const char *end)
 
void handwrittenAtoiMeasure (unsigned int n, unsigned int digits)
 
void follyAtoiMeasure (unsigned int n, unsigned int digits)
 
void clibAtoiMeasure (unsigned int n, unsigned int digits)
 
void lexicalCastMeasure (unsigned int n, unsigned int digits)
 
unsigned u64ToAsciiTable (uint64_t value, char *dst)
 
void u64ToAsciiTableBM (unsigned int n, size_t index)
 
unsigned u64ToAsciiClassic (uint64_t value, char *dst)
 
void u64ToAsciiClassicBM (unsigned int n, size_t index)
 
void u64ToAsciiFollyBM (unsigned int n, size_t index)
 
void u64ToStringClibMeasure (unsigned int n, size_t index)
 
void u64ToStringFollyMeasure (unsigned int n, size_t index)
 
void i64ToStringFollyMeasurePos (unsigned int n, size_t index)
 
void i64ToStringFollyMeasureNeg (unsigned int n, size_t index)
 
void u2aAppendClassicBM (unsigned int n, size_t index)
 
void u2aAppendFollyBM (unsigned int n, size_t index)
 
 BENCHMARK (preallocateTestNoFloat, n)
 
 BENCHMARK (preallocateTestFloat, n)
 
 BENCHMARK (preallocateTestInt8, n)
 
 BENCHMARK (preallocateTestInt16, n)
 
 BENCHMARK (preallocateTestInt32, n)
 
 BENCHMARK (preallocateTestInt64, n)
 
 BENCHMARK_DRAW_LINE ()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 1) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 1) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 2) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 2) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 3) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 3) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 4) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 4) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 5) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 5) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 6) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 6) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 7) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 7) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 8) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 8) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 9) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 9) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 10) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 10) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 11) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 11) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 12) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 12) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 13) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 13) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 14) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 14) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 15) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 15) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 16) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 16) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 17) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 17) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 18) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 18) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 19) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 19) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToAsciiClassicBM, 20) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
 
 BENCHMARK_RELATIVE_PARAM (u64ToAsciiFollyBM, 20) BENCHMARK_DRAW_LINE()
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 1) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 1) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 2) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 2) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 3) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 3) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 4) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 4) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 5) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 5) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 6) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 6) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 7) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 7) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 8) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 8) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 9) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 9) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 10) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 10) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 11) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 11) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 12) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 12) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 13) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 13) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 14) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 14) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 15) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 15) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 16) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 16) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 17) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 17) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 18) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 18) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (u64ToStringClibMeasure, 19) BENCHMARK_RELATIVE_PARAM(u64ToStringFollyMeasure
 
 BENCHMARK_RELATIVE_PARAM (i64ToStringFollyMeasurePos, 19) BENCHMARK_RELATIVE_PARAM(i64ToStringFollyMeasureNeg
 
 BENCHMARK_PARAM (clibAtoiMeasure, 1) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 1) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 2) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 2) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 3) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 3) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 4) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 4) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 5) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 5) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 6) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 6) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 7) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 7) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 8) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 8) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 9) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 9) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 10) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 10) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 11) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 11) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 12) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 12) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 13) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 13) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 14) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 14) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 15) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 15) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 16) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 16) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 17) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 17) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 18) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 18) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (clibAtoiMeasure, 19) BENCHMARK_RELATIVE_PARAM(lexicalCastMeasure
 
 BENCHMARK_RELATIVE_PARAM (handwrittenAtoiMeasure, 19) BENCHMARK_RELATIVE_PARAM(follyAtoiMeasure
 
 BENCHMARK_PARAM (stringVariadicToBM, 32) BENCHMARK_RELATIVE_PARAM(stringIdenticalToBM
 
 BENCHMARK_PARAM (stringVariadicToBM, 1024) BENCHMARK_RELATIVE_PARAM(stringIdenticalToBM
 
 BENCHMARK_PARAM (stringVariadicToBM, 32768) BENCHMARK_RELATIVE_PARAM(stringIdenticalToBM
 
 BENCHMARK_PARAM (fbstringVariadicToBM, 32) BENCHMARK_RELATIVE_PARAM(fbstringIdenticalToBM
 
 BENCHMARK_PARAM (fbstringVariadicToBM, 1024) BENCHMARK_RELATIVE_PARAM(fbstringIdenticalToBM
 
 BENCHMARK_PARAM (fbstringVariadicToBM, 32768) BENCHMARK_RELATIVE_PARAM(fbstringIdenticalToBM
 
 BENCHMARK (stringToBoolNumClassic, n)
 
 BENCHMARK (stringToBoolNumClassicError, n)
 
 BENCHMARK (stringToBoolNumOptional, n)
 
 BENCHMARK (stringToBoolNumOptionalError, n)
 
 BENCHMARK (stringToBoolStrClassic, n)
 
 BENCHMARK (stringToBoolStrClassicError, n)
 
 BENCHMARK (stringToBoolStrOptional, n)
 
 BENCHMARK (stringToBoolStrOptionalError, n)
 
 BENCHMARK (stringToFloatNumClassic, n)
 
 BENCHMARK (stringToFloatNumClassicError, n)
 
 BENCHMARK (stringToFloatNumOptional, n)
 
 BENCHMARK (stringToFloatNumOptionalError, n)
 
 BENCHMARK (stringToFloatStrClassic, n)
 
 BENCHMARK (stringToFloatStrClassicError, n)
 
 BENCHMARK (stringToFloatStrOptional, n)
 
 BENCHMARK (stringToFloatStrOptionalError, n)
 
 BENCHMARK (stringToDoubleNumClassic, n)
 
 BENCHMARK (stringToDoubleNumClassicError, n)
 
 BENCHMARK (stringToDoubleNumOptional, n)
 
 BENCHMARK (stringToDoubleNumOptionalError, n)
 
 BENCHMARK (stringToDoubleStrClassic, n)
 
 BENCHMARK (stringToDoubleStrClassicError, n)
 
 BENCHMARK (stringToDoubleStrOptional, n)
 
 BENCHMARK (stringToDoubleStrOptionalError, n)
 
 BENCHMARK (stringToCharSignedClassic, n)
 
 BENCHMARK (stringToCharSignedClassicError, n)
 
 BENCHMARK (stringToCharSignedOptional, n)
 
 BENCHMARK (stringToCharSignedOptionalError, n)
 
 BENCHMARK (stringToCharUnsignedClassic, n)
 
 BENCHMARK (stringToCharUnsignedClassicError, n)
 
 BENCHMARK (stringToCharUnsignedOptional, n)
 
 BENCHMARK (stringToCharUnsignedOptionalError, n)
 
 BENCHMARK (stringToIntSignedClassic, n)
 
 BENCHMARK (stringToIntSignedClassicError, n)
 
 BENCHMARK (stringToIntSignedOptional, n)
 
 BENCHMARK (stringToIntSignedOptionalError, n)
 
 BENCHMARK (stringToIntUnsignedClassic, n)
 
 BENCHMARK (stringToIntUnsignedClassicError, n)
 
 BENCHMARK (stringToIntUnsignedOptional, n)
 
 BENCHMARK (stringToIntUnsignedOptionalError, n)
 
 BENCHMARK (stringToLongLongSignedClassic, n)
 
 BENCHMARK (stringToLongLongSignedClassicError, n)
 
 BENCHMARK (stringToLongLongSignedOptional, n)
 
 BENCHMARK (stringToLongLongSignedOptionalError, n)
 
 BENCHMARK (stringToLongLongUnsignedClassic, n)
 
 BENCHMARK (stringToLongLongUnsignedClassicError, n)
 
 BENCHMARK (stringToLongLongUnsignedOptional, n)
 
 BENCHMARK (stringToLongLongUnsignedOptionalError, n)
 
 BENCHMARK (ptrPairToCharSignedClassic, n)
 
 BENCHMARK (ptrPairToCharSignedClassicError, n)
 
 BENCHMARK (ptrPairToCharSignedOptional, n)
 
 BENCHMARK (ptrPairToCharSignedOptionalError, n)
 
 BENCHMARK (ptrPairToCharUnsignedClassic, n)
 
 BENCHMARK (ptrPairToCharUnsignedClassicError, n)
 
 BENCHMARK (ptrPairToCharUnsignedOptional, n)
 
 BENCHMARK (ptrPairToCharUnsignedOptionalError, n)
 
 BENCHMARK (ptrPairToIntSignedClassic, n)
 
 BENCHMARK (ptrPairToIntSignedClassicError, n)
 
 BENCHMARK (ptrPairToIntSignedOptional, n)
 
 BENCHMARK (ptrPairToIntSignedOptionalError, n)
 
 BENCHMARK (ptrPairToIntUnsignedClassic, n)
 
 BENCHMARK (ptrPairToIntUnsignedClassicError, n)
 
 BENCHMARK (ptrPairToIntUnsignedOptional, n)
 
 BENCHMARK (ptrPairToIntUnsignedOptionalError, n)
 
 BENCHMARK (ptrPairToLongLongSignedClassic, n)
 
 BENCHMARK (ptrPairToLongLongSignedClassicError, n)
 
 BENCHMARK (ptrPairToLongLongSignedOptional, n)
 
 BENCHMARK (ptrPairToLongLongSignedOptionalError, n)
 
 BENCHMARK (ptrPairToLongLongUnsignedClassic, n)
 
 BENCHMARK (ptrPairToLongLongUnsignedClassicError, n)
 
 BENCHMARK (ptrPairToLongLongUnsignedOptional, n)
 
 BENCHMARK (ptrPairToLongLongUnsignedOptionalError, n)
 
 BENCHMARK_MULTI (intToCharSignedClassic)
 
 BENCHMARK_MULTI (intToCharSignedClassicError)
 
 BENCHMARK_MULTI (intToCharSignedOptional)
 
 BENCHMARK_MULTI (intToCharSignedOptionalError)
 
 BENCHMARK_MULTI (intToCharUnsignedClassic)
 
 BENCHMARK_MULTI (intToCharUnsignedClassicError)
 
 BENCHMARK_MULTI (intToCharUnsignedOptional)
 
 BENCHMARK_MULTI (intToCharUnsignedOptionalError)
 
 BENCHMARK_MULTI (intToIntSignedClassic)
 
 BENCHMARK_MULTI (intToIntSignedClassicError)
 
 BENCHMARK_MULTI (intToIntSignedOptional)
 
 BENCHMARK_MULTI (intToIntSignedOptionalError)
 
 BENCHMARK_MULTI (intToIntUnsignedClassic)
 
 BENCHMARK_MULTI (intToIntUnsignedClassicError)
 
 BENCHMARK_MULTI (intToIntUnsignedOptional)
 
 BENCHMARK_MULTI (intToIntUnsignedOptionalError)
 
 BENCHMARK_MULTI (intToFloatClassic)
 
 BENCHMARK_MULTI (intToFloatClassicError)
 
 BENCHMARK_MULTI (intToFloatOptional)
 
 BENCHMARK_MULTI (intToFloatOptionalError)
 
 BENCHMARK_MULTI (floatToFloatClassic)
 
 BENCHMARK_MULTI (floatToFloatClassicError)
 
 BENCHMARK_MULTI (floatToFloatOptional)
 
 BENCHMARK_MULTI (floatToFloatOptionalError)
 
 BENCHMARK_MULTI (floatToIntClassic)
 
 BENCHMARK_MULTI (floatToIntClassicError)
 
 BENCHMARK_MULTI (floatToIntOptional)
 
 BENCHMARK_MULTI (floatToIntOptionalError)
 
int main (int argc, char **argv)
 

Variables

uint64_t folly::conv_bench_detail::uint64Num []
 
int64_t folly::conv_bench_detail::int64Pos []
 
int64_t folly::conv_bench_detail::int64Neg []
 
static StringPiece pc1 = "1234567890123456789"
 
size_t folly::conv_bench_detail::bigInt = 11424545345345
 
size_t folly::conv_bench_detail::smallInt = 104
 
char folly::conv_bench_detail::someString [] = "this is some nice string"
 
char folly::conv_bench_detail::otherString [] = "this is a long string, so it's not so nice"
 
char folly::conv_bench_detail::reallyShort [] = "meh"
 
std::string folly::conv_bench_detail::stdString = "std::strings are very nice"
 
float folly::conv_bench_detail::fValue = 1.2355f
 
double folly::conv_bench_detail::dValue = 345345345.435
 
int8_t folly::conv_bench_detail::i8s []
 
uint8_t folly::conv_bench_detail::u8s []
 
int16_t folly::conv_bench_detail::i16s []
 
uint16_t folly::conv_bench_detail::u16s []
 
int32_t folly::conv_bench_detail::i32s []
 
uint32_t folly::conv_bench_detail::u32s []
 
int64_t folly::conv_bench_detail::i64s []
 
uint64_t folly::conv_bench_detail::u64s []
 
static const StringIdenticalToBM< std::stringstringIdenticalToBM
 
static const StringVariadicToBM< std::stringstringVariadicToBM
 
static const StringIdenticalToBM< fbstringfbstringIdenticalToBM
 
static const StringVariadicToBM< fbstringfbstringVariadicToBM
 
std::array< int, 4 > folly::conv_bench_detail::int2ScharGood {{-128, 127, 0, -50}}
 
std::array< int, 4 > folly::conv_bench_detail::int2ScharBad {{-129, 128, 255, 10000}}
 
std::array< int, 4 > folly::conv_bench_detail::int2UcharGood {{0, 1, 254, 255}}
 
std::array< int, 4 > folly::conv_bench_detail::int2UcharBad {{-128, -1000, 256, -1}}
 
std::array< long long, 4 > folly::conv_bench_detail::ll2SintOrFloatGood {{-2, -1, 0, 1}}
 
std::array< long long, 4 > folly::conv_bench_detail::ll2SintOrFloatBad
 
std::array< long long, 4 > folly::conv_bench_detail::ll2UintGood {{1, 2, 3, 4}}
 
std::array< long long, 4 > folly::conv_bench_detail::ll2UintBad {{-1, -2, -3, -4}}
 
std::array< double, 4 > folly::conv_bench_detail::double2FloatGood {{1.0, 1.25, 2.5, 1000.0}}
 
std::array< double, 4 > folly::conv_bench_detail::double2FloatBad {{1e100, 1e101, 1e102, 1e103}}
 
std::array< double, 4 > folly::conv_bench_detail::double2IntGood {{1.0, 10.0, 100.0, 1000.0}}
 
std::array< double, 4 > folly::conv_bench_detail::double2IntBad {{1e100, 1.25, 2.5, 100.00001}}
 

Macro Definition Documentation

#define ARITH_TO_ARITH_BENCHMARK (   type,
  name,
  pass,
  fail 
)
Value:
BENCHMARK_MULTI(name##Classic) { \
return arithToArithClassic<type>(pass.data(), pass.size()); \
} \
BENCHMARK_MULTI(name##ClassicError) { \
return arithToArithClassic<type>(fail.data(), fail.size()); \
} \
return arithToArithOptional<type>(pass.data(), pass.size()); \
} \
BENCHMARK_MULTI(name##OptionalError) { \
return arithToArithOptional<type>(fail.data(), fail.size()); \
}
const char * name
Definition: http_parser.c:437
void fail()
BENCHMARK_MULTI(intToCharSignedClassic)

Definition at line 1049 of file ConvBenchmark.cpp.

#define DEFINE_BENCHMARK_GROUP (   n)
Value:
BENCHMARK_DRAW_LINE()
BENCHMARK_PARAM(u64ToAsciiClassicBM, 1) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
void u64ToAsciiTableBM(unsigned int n, size_t index)
BENCHMARK_RELATIVE_PARAM(u64ToAsciiFollyBM, 1) BENCHMARK_DRAW_LINE()
void u64ToAsciiFollyBM(unsigned int n, size_t index)
void u64ToAsciiClassicBM(unsigned int n, size_t index)

Definition at line 891 of file ConvBenchmark.cpp.

#define DEFINE_BENCHMARK_GROUP (   n)
Value:
void i64ToStringFollyMeasurePos(unsigned int n, size_t index)
BENCHMARK_DRAW_LINE()
void i64ToStringFollyMeasureNeg(unsigned int n, size_t index)
BENCHMARK_PARAM(u64ToAsciiClassicBM, 1) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
void u64ToStringClibMeasure(unsigned int n, size_t index)
BENCHMARK_RELATIVE_PARAM(u64ToAsciiFollyBM, 1) BENCHMARK_DRAW_LINE()
void u64ToStringFollyMeasure(unsigned int n, size_t index)

Definition at line 891 of file ConvBenchmark.cpp.

#define DEFINE_BENCHMARK_GROUP (   n)
Value:
BENCHMARK_DRAW_LINE()
void clibAtoiMeasure(unsigned int n, unsigned int digits)
BENCHMARK_PARAM(u64ToAsciiClassicBM, 1) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
void follyAtoiMeasure(unsigned int n, unsigned int digits)
BENCHMARK_RELATIVE_PARAM(u64ToAsciiFollyBM, 1) BENCHMARK_DRAW_LINE()
void handwrittenAtoiMeasure(unsigned int n, unsigned int digits)
void lexicalCastMeasure(unsigned int n, unsigned int digits)

Definition at line 891 of file ConvBenchmark.cpp.

#define DEFINE_BENCHMARK_GROUP (   T,
 
)
Value:
BENCHMARK_PARAM(T##VariadicToBM, n) \
BENCHMARK_RELATIVE_PARAM(T##IdenticalToBM, n) \
#define T(v)
Definition: http_parser.c:233
BENCHMARK_DRAW_LINE()
BENCHMARK_PARAM(u64ToAsciiClassicBM, 1) BENCHMARK_RELATIVE_PARAM(u64ToAsciiTableBM
BENCHMARK_RELATIVE_PARAM(u64ToAsciiFollyBM, 1) BENCHMARK_DRAW_LINE()

Definition at line 891 of file ConvBenchmark.cpp.

#define FLOAT_TO_ARITH_BENCHMARK (   type,
  name,
  pass,
  fail 
)    ARITH_TO_ARITH_BENCHMARK(type, floatTo##name, pass, fail)

Definition at line 1066 of file ConvBenchmark.cpp.

#define FOLLY_RANGE_CHECK_TO_STRING (   x)    std::to_string(x)

Definition at line 36 of file ConvBenchmark.cpp.

Referenced by u64ToStringClibMeasure().

#define INT_TO_ARITH_BENCHMARK (   type,
  name,
  pass,
  fail 
)    ARITH_TO_ARITH_BENCHMARK(type, intTo##name, pass, fail)

Definition at line 1063 of file ConvBenchmark.cpp.

#define PTR_PAIR_TO_INT_BENCHMARK (   type,
  name,
  pass,
  fail 
)
Value:
BENCHMARK(ptrPairTo##name##Classic, n) { \
ptrPairToIntClassic<type>(pass, n); \
} \
BENCHMARK(ptrPairTo##name##ClassicError, n) { \
ptrPairToIntClassic<type>(fail, n); \
} \
BENCHMARK(ptrPairTo##name##Optional, n) { \
ptrPairToIntOptional<type>(pass, n); \
} \
BENCHMARK(ptrPairTo##name##OptionalError, n) { \
ptrPairToIntOptional<type>(fail, n); \
}
const char * name
Definition: http_parser.c:437
void fail()
BENCHMARK(preallocateTestNoFloat, n)

Definition at line 1035 of file ConvBenchmark.cpp.

#define STRING_TO_TYPE_BENCHMARK (   type,
  name,
  pass,
  fail 
)
Value:
BENCHMARK(stringTo##name##Classic, n) { \
stringToTypeClassic<type>(pass, n); \
} \
BENCHMARK(stringTo##name##ClassicError, n) { \
stringToTypeClassic<type>(fail, n); \
} \
BENCHMARK(stringTo##name##Optional, n) { \
stringToTypeOptional<type>(pass, n); \
} \
BENCHMARK(stringTo##name##OptionalError, n) { \
stringToTypeOptional<type>(fail, n); \
}
const char * name
Definition: http_parser.c:437
void fail()
BENCHMARK(preallocateTestNoFloat, n)

Definition at line 1021 of file ConvBenchmark.cpp.

Function Documentation

BENCHMARK ( preallocateTestNoFloat  ,
 
)

Definition at line 520 of file ConvBenchmark.cpp.

References folly::conv_bench_detail::bigInt, folly::doNotOptimizeAway(), folly::conv_bench_detail::dValue, i, folly::conv_bench_detail::otherString, folly::conv_bench_detail::reallyShort, folly::size(), folly::conv_bench_detail::smallInt, folly::conv_bench_detail::someString, and folly::conv_bench_detail::stdString.

Referenced by BENCHMARK().

520  {
521  for (size_t i = 0; i < n; ++i) {
523  to<std::string>(bigInt, someString, stdString, otherString).size());
524  doNotOptimizeAway(to<std::string>(reallyShort, smallInt).size());
525  doNotOptimizeAway(to<std::string>(bigInt, stdString).size());
527  to<std::string>(bigInt, stdString, dValue, otherString).size());
528  doNotOptimizeAway(to<std::string>(bigInt, someString, reallyShort).size());
529  }
530 }
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
BENCHMARK ( preallocateTestFloat  ,
 
)

Definition at line 532 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), folly::conv_bench_detail::dValue, folly::conv_bench_detail::fValue, i, folly::size(), and folly::conv_bench_detail::stdString.

532  {
533  for (size_t i = 0; i < n; ++i) {
534  doNotOptimizeAway(to<std::string>(stdString, ',', fValue, dValue).size());
535  doNotOptimizeAway(to<std::string>(stdString, ',', dValue).size());
536  }
537 }
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
BENCHMARK ( preallocateTestInt8  ,
 
)

Definition at line 595 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), i, folly::conv_bench_detail::i8s, folly::size(), and folly::conv_bench_detail::u8s.

595  {
596  for (size_t i = 0; i < n; ++i) {
597  doNotOptimizeAway(to<std::string>(
598  i8s[0],
599  ',',
600  u8s[0],
601  ',',
602  i8s[1],
603  ',',
604  u8s[1],
605  ',',
606  i8s[2],
607  ',',
608  u8s[2])
609  .size());
610  }
611 }
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
BENCHMARK ( preallocateTestInt16  ,
 
)

Definition at line 613 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), i, folly::conv_bench_detail::i16s, folly::size(), and folly::conv_bench_detail::u16s.

613  {
614  for (size_t i = 0; i < n; ++i) {
615  doNotOptimizeAway(to<std::string>(
616  i16s[0],
617  ',',
618  u16s[0],
619  ',',
620  i16s[1],
621  ',',
622  u16s[1],
623  ',',
624  i16s[2],
625  ',',
626  u16s[2])
627  .size());
628  }
629 }
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
BENCHMARK ( preallocateTestInt32  ,
 
)

Definition at line 631 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), i, folly::conv_bench_detail::i32s, folly::size(), and folly::conv_bench_detail::u32s.

631  {
632  for (size_t i = 0; i < n; ++i) {
633  doNotOptimizeAway(to<std::string>(
634  i32s[0],
635  ',',
636  u32s[0],
637  ',',
638  i32s[1],
639  ',',
640  u32s[1],
641  ',',
642  i32s[2],
643  ',',
644  u32s[2])
645  .size());
646  }
647 }
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
BENCHMARK ( preallocateTestInt64  ,
 
)

Definition at line 649 of file ConvBenchmark.cpp.

References BENCHMARK(), BENCHMARK_DRAW_LINE(), folly::conv_bench_detail::bigInt, folly::doNotOptimizeAway(), folly::conv_bench_detail::dValue, i, folly::conv_bench_detail::i64s, folly::conv_bench_detail::otherString, folly::conv_bench_detail::reallyShort, folly::size(), folly::conv_bench_detail::smallInt, folly::conv_bench_detail::someString, folly::conv_bench_detail::stdString, and folly::conv_bench_detail::u64s.

649  {
650  for (size_t i = 0; i < n; ++i) {
651  doNotOptimizeAway(to<std::string>(
652  i64s[0],
653  ',',
654  u64s[0],
655  ',',
656  i64s[1],
657  ',',
658  u64s[1],
659  ',',
660  i64s[2],
661  ',',
662  u64s[2])
663  .size());
664  }
665 }
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
BENCHMARK ( stringToBoolNumClassic  ,
 
)

Definition at line 1069 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToBoolNumClassicError  ,
 
)

Definition at line 1069 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToBoolNumOptional  ,
 
)

Definition at line 1069 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToBoolNumOptionalError  ,
 
)

Definition at line 1069 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToBoolStrClassic  ,
 
)

Definition at line 1070 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToBoolStrClassicError  ,
 
)

Definition at line 1070 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToBoolStrOptional  ,
 
)

Definition at line 1070 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToBoolStrOptionalError  ,
 
)

Definition at line 1070 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToFloatNumClassic  ,
 
)

Definition at line 1072 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToFloatNumClassicError  ,
 
)

Definition at line 1072 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToFloatNumOptional  ,
 
)

Definition at line 1072 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToFloatNumOptionalError  ,
 
)

Definition at line 1072 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToFloatStrClassic  ,
 
)

Definition at line 1073 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToFloatStrClassicError  ,
 
)

Definition at line 1073 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToFloatStrOptional  ,
 
)

Definition at line 1073 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToFloatStrOptionalError  ,
 
)

Definition at line 1073 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToDoubleNumClassic  ,
 
)

Definition at line 1074 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToDoubleNumClassicError  ,
 
)

Definition at line 1074 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToDoubleNumOptional  ,
 
)

Definition at line 1074 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToDoubleNumOptionalError  ,
 
)

Definition at line 1074 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToDoubleStrClassic  ,
 
)

Definition at line 1075 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToDoubleStrClassicError  ,
 
)

Definition at line 1075 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToDoubleStrOptional  ,
 
)

Definition at line 1075 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToDoubleStrOptionalError  ,
 
)

Definition at line 1075 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToCharSignedClassic  ,
 
)

Definition at line 1077 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToCharSignedClassicError  ,
 
)

Definition at line 1077 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToCharSignedOptional  ,
 
)

Definition at line 1077 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToCharSignedOptionalError  ,
 
)

Definition at line 1077 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToCharUnsignedClassic  ,
 
)

Definition at line 1078 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToCharUnsignedClassicError  ,
 
)

Definition at line 1078 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToCharUnsignedOptional  ,
 
)

Definition at line 1078 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToCharUnsignedOptionalError  ,
 
)

Definition at line 1078 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToIntSignedClassic  ,
 
)

Definition at line 1079 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToIntSignedClassicError  ,
 
)

Definition at line 1079 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToIntSignedOptional  ,
 
)

Definition at line 1079 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToIntSignedOptionalError  ,
 
)

Definition at line 1079 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToIntUnsignedClassic  ,
 
)

Definition at line 1080 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToIntUnsignedClassicError  ,
 
)

Definition at line 1080 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToIntUnsignedOptional  ,
 
)

Definition at line 1080 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToIntUnsignedOptionalError  ,
 
)

Definition at line 1080 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToLongLongSignedClassic  ,
 
)

Definition at line 1085 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToLongLongSignedClassicError  ,
 
)

Definition at line 1085 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToLongLongSignedOptional  ,
 
)

Definition at line 1085 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToLongLongSignedOptionalError  ,
 
)

Definition at line 1085 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToLongLongUnsignedClassic  ,
 
)

Definition at line 1090 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToLongLongUnsignedClassicError  ,
 
)

Definition at line 1090 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToLongLongUnsignedOptional  ,
 
)

Definition at line 1090 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( stringToLongLongUnsignedOptionalError  ,
 
)

Definition at line 1090 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToCharSignedClassic  ,
 
)

Definition at line 1093 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToCharSignedClassicError  ,
 
)

Definition at line 1093 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToCharSignedOptional  ,
 
)

Definition at line 1093 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToCharSignedOptionalError  ,
 
)

Definition at line 1093 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToCharUnsignedClassicError  ,
 
)

Definition at line 1094 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToCharUnsignedClassic  ,
 
)

Definition at line 1094 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToCharUnsignedOptional  ,
 
)

Definition at line 1094 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToCharUnsignedOptionalError  ,
 
)

Definition at line 1094 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToIntSignedClassicError  ,
 
)

Definition at line 1095 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToIntSignedClassic  ,
 
)

Definition at line 1095 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToIntSignedOptional  ,
 
)

Definition at line 1095 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToIntSignedOptionalError  ,
 
)

Definition at line 1095 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToIntUnsignedClassicError  ,
 
)

Definition at line 1100 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToIntUnsignedClassic  ,
 
)

Definition at line 1100 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToIntUnsignedOptional  ,
 
)

Definition at line 1100 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToIntUnsignedOptionalError  ,
 
)

Definition at line 1100 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToLongLongSignedClassic  ,
 
)

Definition at line 1105 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToLongLongSignedClassicError  ,
 
)

Definition at line 1105 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToLongLongSignedOptional  ,
 
)

Definition at line 1105 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToLongLongSignedOptionalError  ,
 
)

Definition at line 1105 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToLongLongUnsignedClassicError  ,
 
)

Definition at line 1110 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToLongLongUnsignedClassic  ,
 
)

Definition at line 1110 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToLongLongUnsignedOptional  ,
 
)

Definition at line 1110 of file ConvBenchmark.cpp.

1130 {
BENCHMARK ( ptrPairToLongLongUnsignedOptionalError  ,
 
)

Definition at line 1110 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_DRAW_LINE ( )

Referenced by BENCHMARK().

BENCHMARK_MULTI ( intToCharSignedClassicError  )

Definition at line 1113 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToCharSignedClassic  )

Definition at line 1113 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToCharSignedOptional  )

Definition at line 1113 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToCharSignedOptionalError  )

Definition at line 1113 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToCharUnsignedClassicError  )

Definition at line 1114 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToCharUnsignedClassic  )

Definition at line 1114 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToCharUnsignedOptional  )

Definition at line 1114 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToCharUnsignedOptionalError  )

Definition at line 1114 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToIntSignedClassic  )

Definition at line 1115 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToIntSignedClassicError  )

Definition at line 1115 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToIntSignedOptional  )

Definition at line 1115 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToIntSignedOptionalError  )

Definition at line 1115 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToIntUnsignedClassicError  )

Definition at line 1116 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToIntUnsignedClassic  )

Definition at line 1116 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToIntUnsignedOptional  )

Definition at line 1116 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToIntUnsignedOptionalError  )

Definition at line 1116 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToFloatClassicError  )

Definition at line 1118 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToFloatClassic  )

Definition at line 1118 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToFloatOptional  )

Definition at line 1118 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( intToFloatOptionalError  )

Definition at line 1118 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( floatToFloatClassicError  )

Definition at line 1120 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( floatToFloatClassic  )

Definition at line 1120 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( floatToFloatOptional  )

Definition at line 1120 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( floatToFloatOptionalError  )

Definition at line 1120 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( floatToIntClassic  )

Definition at line 1122 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( floatToIntClassicError  )

Definition at line 1122 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( floatToIntOptional  )

Definition at line 1122 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_MULTI ( floatToIntOptionalError  )

Definition at line 1122 of file ConvBenchmark.cpp.

1130 {
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
 
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
 
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
 
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
 
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
 
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
 
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
 
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
 
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
 
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
10   
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
11   
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
12   
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
13   
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
14   
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
15   
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
16   
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
17   
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
18   
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
19   
)
BENCHMARK_PARAM ( u64ToAsciiClassicBM  ,
20   
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
 
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
 
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
 
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
 
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
 
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
 
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
 
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
 
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
 
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
10   
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
11   
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
12   
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
13   
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
14   
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
15   
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
16   
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
17   
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
18   
)
BENCHMARK_PARAM ( u64ToStringClibMeasure  ,
19   
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
 
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
 
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
 
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
 
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
 
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
 
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
 
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
 
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
 
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
10   
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
11   
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
12   
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
13   
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
14   
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
15   
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
16   
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
17   
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
18   
)
BENCHMARK_PARAM ( clibAtoiMeasure  ,
19   
)
BENCHMARK_PARAM ( stringVariadicToBM  ,
32   
)
BENCHMARK_PARAM ( stringVariadicToBM  ,
1024   
)
BENCHMARK_PARAM ( stringVariadicToBM  ,
32768   
)
BENCHMARK_PARAM ( fbstringVariadicToBM  ,
32   
)
BENCHMARK_PARAM ( fbstringVariadicToBM  ,
1024   
)
BENCHMARK_PARAM ( fbstringVariadicToBM  ,
32768   
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
 
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
 
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
 
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
 
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
 
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
 
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
 
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
 
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
 
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
10   
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
11   
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
12   
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
13   
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
14   
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
15   
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
16   
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
17   
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
18   
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
19   
)
BENCHMARK_RELATIVE_PARAM ( u64ToAsciiFollyBM  ,
20   
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
 
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
 
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
 
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
 
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
 
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
 
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
 
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
 
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
 
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
10   
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
11   
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
12   
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
13   
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
14   
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
15   
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
16   
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
17   
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
18   
)
BENCHMARK_RELATIVE_PARAM ( i64ToStringFollyMeasurePos  ,
19   
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
 
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
 
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
 
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
 
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
 
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
 
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
 
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
 
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
 
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
10   
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
11   
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
12   
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
13   
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
14   
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
15   
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
16   
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
17   
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
18   
)
BENCHMARK_RELATIVE_PARAM ( handwrittenAtoiMeasure  ,
19   
)
void clibAtoiMeasure ( unsigned int  n,
unsigned int  digits 
)

Definition at line 319 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, folly::Range< Iter >::size(), and folly::Range< Iter >::subpiece().

319  {
320  auto p = pc1.subpiece(pc1.size() - digits, digits);
321  assert(*p.end() == 0);
322  FOR_EACH_RANGE (i, 0, n) { doNotOptimizeAway(atoll(p.begin())); }
323 }
constexpr size_type size() const
Definition: Range.h:431
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
Range subpiece(size_type first, size_type length=npos) const
Definition: Range.h:686
static StringPiece pc1
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
void follyAtoiMeasure ( unsigned int  n,
unsigned int  digits 
)

Definition at line 312 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, folly::Range< Iter >::size(), and folly::Range< Iter >::subpiece().

312  {
313  auto p = pc1.subpiece(pc1.size() - digits, digits);
314  FOR_EACH_RANGE (i, 0, n) {
315  doNotOptimizeAway(folly::to<int64_t>(p.begin(), p.end()));
316  }
317 }
constexpr size_type size() const
Definition: Range.h:431
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
Range subpiece(size_type first, size_type length=npos) const
Definition: Range.h:686
static StringPiece pc1
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
static int64_t handwrittenAtoi ( const char *  start,
const char *  end 
)
static

Definition at line 265 of file ConvBenchmark.cpp.

References FOLLY_FALLTHROUGH, int64_t, and start.

Referenced by handwrittenAtoiMeasure().

265  {
266  bool positive = true;
267  int64_t retVal = 0;
268 
269  if (start == end) {
270  throw std::runtime_error("empty string");
271  }
272 
273  while (start < end && isspace(*start)) {
274  ++start;
275  }
276 
277  switch (*start) {
278  case '-':
279  positive = false;
281  case '+':
282  ++start;
284  default:
285  break;
286  }
287 
288  while (start < end && *start >= '0' && *start <= '9') {
289  auto const newRetVal = retVal * 10 + (*start++ - '0');
290  if (newRetVal < retVal) {
291  throw std::runtime_error("overflow");
292  }
293  retVal = newRetVal;
294  }
295 
296  if (start != end) {
297  throw std::runtime_error("extra chars at the end");
298  }
299 
300  return positive ? retVal : -retVal;
301 }
auto end(TestAdlIterable &instance)
Definition: ForeachTest.cpp:62
auto start
#define FOLLY_FALLTHROUGH
Definition: CppAttributes.h:63
void handwrittenAtoiMeasure ( unsigned int  n,
unsigned int  digits 
)

Definition at line 305 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), FOR_EACH_RANGE, handwrittenAtoi(), i, folly::Range< Iter >::size(), and folly::Range< Iter >::subpiece().

305  {
306  auto p = pc1.subpiece(pc1.size() - digits, digits);
307  FOR_EACH_RANGE (i, 0, n) {
308  doNotOptimizeAway(handwrittenAtoi(p.begin(), p.end()));
309  }
310 }
constexpr size_type size() const
Definition: Range.h:431
static int64_t handwrittenAtoi(const char *start, const char *end)
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
Range subpiece(size_type first, size_type length=npos) const
Definition: Range.h:686
static StringPiece pc1
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
void i64ToStringFollyMeasureNeg ( unsigned int  n,
size_t  index 
)

Definition at line 442 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, folly::conv_bench_detail::int64Neg, and folly::size().

442  {
443  checkArrayIndex(int64Neg, index);
444  FOR_EACH_RANGE (i, 0, n) {
445  doNotOptimizeAway(to<std::string>(int64Neg[index] - (i % 8)).size());
446  }
447 }
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
void i64ToStringFollyMeasurePos ( unsigned int  n,
size_t  index 
)

Definition at line 435 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, folly::conv_bench_detail::int64Pos, and folly::size().

435  {
436  checkArrayIndex(int64Pos, index);
437  FOR_EACH_RANGE (i, 0, n) {
438  doNotOptimizeAway(to<std::string>(int64Pos[index] + (i % 8)).size());
439  }
440 }
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
void lexicalCastMeasure ( unsigned int  n,
unsigned int  digits 
)

Definition at line 325 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, folly::Range< Iter >::size(), and folly::Range< Iter >::subpiece().

325  {
326  auto p = pc1.subpiece(pc1.size() - digits, digits);
327  assert(*p.end() == 0);
328  FOR_EACH_RANGE (i, 0, n) {
329  doNotOptimizeAway(boost::lexical_cast<uint64_t>(p.begin()));
330  }
331 }
constexpr size_type size() const
Definition: Range.h:431
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
Range subpiece(size_type first, size_type length=npos) const
Definition: Range.h:686
static StringPiece pc1
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
int main ( int  argc,
char **  argv 
)

Definition at line 1130 of file ConvBenchmark.cpp.

References folly::runBenchmarks().

1130  {
1131  gflags::ParseCommandLineFlags(&argc, &argv, true);
1133  return 0;
1134 }
void runBenchmarks()
Definition: Benchmark.cpp:456
char ** argv
void u2aAppendClassicBM ( unsigned int  n,
size_t  index 
)

Definition at line 451 of file ConvBenchmark.cpp.

References buffer(), folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, s, u64ToAsciiClassic(), and folly::conv_bench_detail::uint64Num.

451  {
452  checkArrayIndex(uint64Num, index);
453  string s;
454  FOR_EACH_RANGE (i, 0, n) {
455  // auto buf = &s.back() + 1;
456  char buffer[20];
457  s.append(buffer, u64ToAsciiClassic(uint64Num[index] + (i % 8), buffer));
458  doNotOptimizeAway(s.size());
459  }
460 }
std::vector< uint8_t > buffer(kBufferSize+16)
unsigned u64ToAsciiClassic(uint64_t value, char *dst)
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
static set< string > s
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
void u2aAppendFollyBM ( unsigned int  n,
size_t  index 
)

Definition at line 462 of file ConvBenchmark.cpp.

References buffer(), folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, s, folly::conv_bench_detail::uint64Num, and folly::uint64ToBufferUnsafe().

462  {
463  checkArrayIndex(uint64Num, index);
464  string s;
465  FOR_EACH_RANGE (i, 0, n) {
466  // auto buf = &s.back() + 1;
467  char buffer[20];
468  s.append(buffer, uint64ToBufferUnsafe(uint64Num[index] + (i % 8), buffer));
469  doNotOptimizeAway(s.size());
470  }
471 }
std::vector< uint8_t > buffer(kBufferSize+16)
uint32_t uint64ToBufferUnsafe(uint64_t v, char *const buffer)
Definition: Conv.h:383
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
static set< string > s
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
unsigned u64ToAsciiClassic ( uint64_t  value,
char *  dst 
)

Definition at line 376 of file ConvBenchmark.cpp.

References cpp.ast::next(), start, and folly::f14::swap().

Referenced by u2aAppendClassicBM(), and u64ToAsciiClassicBM().

376  {
377  // Write backwards.
378  char* next = (char*)dst;
379  char* start = next;
380  do {
381  *next++ = '0' + (value % 10);
382  value /= 10;
383  } while (value != 0);
384  unsigned length = next - start;
385 
386  // Reverse in-place.
387  next--;
388  while (next > start) {
389  char swap = *next;
390  *next = *start;
391  *start = swap;
392  next--;
393  start++;
394  }
395  return length;
396 }
static const char *const value
Definition: Conv.cpp:50
auto start
void swap(SwapTrackingAlloc< T > &, SwapTrackingAlloc< T > &)
Definition: F14TestUtil.h:414
def next(obj)
Definition: ast.py:58
void u64ToAsciiClassicBM ( unsigned int  n,
size_t  index 
)

Definition at line 398 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, u64ToAsciiClassic(), and folly::conv_bench_detail::uint64Num.

398  {
399  checkArrayIndex(uint64Num, index);
400  char buf[20];
401  FOR_EACH_RANGE (i, 0, n) {
402  doNotOptimizeAway(u64ToAsciiClassic(uint64Num[index] + (i % 8), buf));
403  }
404 }
unsigned u64ToAsciiClassic(uint64_t value, char *dst)
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
void u64ToAsciiFollyBM ( unsigned int  n,
size_t  index 
)

Definition at line 406 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, folly::conv_bench_detail::uint64Num, and folly::uint64ToBufferUnsafe().

406  {
407  checkArrayIndex(uint64Num, index);
408  char buf[20];
409  FOR_EACH_RANGE (i, 0, n) {
410  doNotOptimizeAway(uint64ToBufferUnsafe(uint64Num[index] + (i % 8), buf));
411  }
412 }
uint32_t uint64ToBufferUnsafe(uint64_t v, char *const buffer)
Definition: Conv.h:383
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
unsigned u64ToAsciiTable ( uint64_t  value,
char *  dst 
)

Definition at line 335 of file ConvBenchmark.cpp.

References folly::digits10(), i, cpp.ast::next(), and uint32_t.

Referenced by u64ToAsciiTableBM().

335  {
336  static const char digits[201] =
337  "00010203040506070809"
338  "10111213141516171819"
339  "20212223242526272829"
340  "30313233343536373839"
341  "40414243444546474849"
342  "50515253545556575859"
343  "60616263646566676869"
344  "70717273747576777879"
345  "80818283848586878889"
346  "90919293949596979899";
347 
348  uint32_t const length = digits10(value);
349  uint32_t next = length - 1;
350  while (value >= 100) {
351  auto const i = (value % 100) * 2;
352  value /= 100;
353  dst[next] = digits[i + 1];
354  dst[next - 1] = digits[i];
355  next -= 2;
356  }
357  // Handle last 1-2 digits
358  if (value < 10) {
359  dst[next] = '0' + uint32_t(value);
360  } else {
361  auto i = uint32_t(value) * 2;
362  dst[next] = digits[i + 1];
363  dst[next - 1] = digits[i];
364  }
365  return length;
366 }
uint32_t digits10(uint64_t v)
Definition: Conv.h:295
static const char *const value
Definition: Conv.cpp:50
def next(obj)
Definition: ast.py:58
void u64ToAsciiTableBM ( unsigned int  n,
size_t  index 
)

Definition at line 368 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, u64ToAsciiTable(), and folly::conv_bench_detail::uint64Num.

368  {
369  checkArrayIndex(uint64Num, index);
370  char buf[20];
371  FOR_EACH_RANGE (i, 0, n) {
372  doNotOptimizeAway(u64ToAsciiTable(uint64Num[index] + (i % 8), buf));
373  }
374 }
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
unsigned u64ToAsciiTable(uint64_t value, char *dst)
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
void u64ToStringClibMeasure ( unsigned int  n,
size_t  index 
)

Definition at line 416 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), FOLLY_RANGE_CHECK_TO_STRING, FOR_EACH_RANGE, i, folly::size(), and folly::conv_bench_detail::uint64Num.

416  {
417  // FOLLY_RANGE_CHECK_TO_STRING expands to std::to_string, except on Android
418  // where std::to_string is not supported
419  checkArrayIndex(uint64Num, index);
420  FOR_EACH_RANGE (i, 0, n) {
422  FOLLY_RANGE_CHECK_TO_STRING(uint64Num[index] + (i % 8)).size());
423  }
424 }
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
#define FOLLY_RANGE_CHECK_TO_STRING(x)
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258
void u64ToStringFollyMeasure ( unsigned int  n,
size_t  index 
)

Definition at line 426 of file ConvBenchmark.cpp.

References folly::doNotOptimizeAway(), FOR_EACH_RANGE, i, folly::size(), and folly::conv_bench_detail::uint64Num.

426  {
427  checkArrayIndex(uint64Num, index);
428  FOR_EACH_RANGE (i, 0, n) {
429  doNotOptimizeAway(to<std::string>(uint64Num[index] + (i % 8)).size());
430  }
431 }
#define FOR_EACH_RANGE(i, begin, end)
Definition: Foreach.h:313
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
auto doNotOptimizeAway(const T &datum) -> typename std::enable_if< !detail::DoNotOptimizeAwayNeedsIndirect< T >::value >::type
Definition: Benchmark.h:258

Variable Documentation

const StringIdenticalToBM<fbstring> fbstringIdenticalToBM
static

Definition at line 721 of file ConvBenchmark.cpp.

const StringVariadicToBM<fbstring> fbstringVariadicToBM
static

Definition at line 722 of file ConvBenchmark.cpp.

StringPiece pc1 = "1234567890123456789"
static

Definition at line 303 of file ConvBenchmark.cpp.

const StringIdenticalToBM<std::string> stringIdenticalToBM
static

Definition at line 719 of file ConvBenchmark.cpp.

const StringVariadicToBM<std::string> stringVariadicToBM
static

Definition at line 720 of file ConvBenchmark.cpp.