mirror of
https://github.com/apache/arrow.git
synced 2026-10-29 00:56:31 +08:00
Remove BM_ benchmark prefix
This commit is contained in:
1 parent
5cebe2c233
commit
8334c68f7f
15 files changed
+134
-134
No files matched your search
@@ -36,7 +36,7 @@ Status MakePrimitive(int64_t length, int64_t null_count, std::shared_ptr<Array>*
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
static void BM_BuildInt32ColumnByChunk(
|
||||
static void BuildInt32ColumnByChunk(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
ArrayVector arrays;
|
||||
for (int chunk_n = 0; chunk_n < state.range(0); ++chunk_n) {
|
||||
@@ -52,6 +52,6 @@ static void BM_BuildInt32ColumnByChunk(
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(BM_BuildInt32ColumnByChunk)->Range(5, 50000);
|
||||
BENCHMARK(BuildInt32ColumnByChunk)->Range(5, 50000);
|
||||
|
||||
} // namespace arrow
|
||||
@@ -31,7 +31,7 @@
|
||||
namespace arrow {
|
||||
namespace compute {
|
||||
|
||||
static void BM_BuildDictionary(benchmark::State& state) { // NOLINT non-const reference
|
||||
static void BuildDictionary(benchmark::State& state) { // NOLINT non-const reference
|
||||
const int64_t iterations = 1024;
|
||||
|
||||
std::vector<int64_t> values;
|
||||
@@ -55,7 +55,7 @@ static void BM_BuildDictionary(benchmark::State& state) { // NOLINT non-const r
|
||||
state.SetBytesProcessed(state.iterations() * values.size() * sizeof(int64_t));
|
||||
}
|
||||
|
||||
static void BM_BuildStringDictionary(
|
||||
static void BuildStringDictionary(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
const int64_t iterations = 1024 * 64;
|
||||
// Pre-render strings
|
||||
@@ -172,34 +172,34 @@ void BenchDictionaryEncode(benchmark::State& state, const ParamType& params,
|
||||
state.SetBytesProcessed(state.iterations() * params.GetBytesProcessed(length));
|
||||
}
|
||||
|
||||
static void BM_UniqueUInt8NoNulls(benchmark::State& state) {
|
||||
static void UniqueUInt8NoNulls(benchmark::State& state) {
|
||||
BenchUnique(state, HashParams<UInt8Type>{0}, state.range(0), state.range(1));
|
||||
}
|
||||
|
||||
static void BM_UniqueUInt8WithNulls(benchmark::State& state) {
|
||||
static void UniqueUInt8WithNulls(benchmark::State& state) {
|
||||
BenchUnique(state, HashParams<UInt8Type>{0.05}, state.range(0), state.range(1));
|
||||
}
|
||||
|
||||
static void BM_UniqueInt64NoNulls(benchmark::State& state) {
|
||||
static void UniqueInt64NoNulls(benchmark::State& state) {
|
||||
BenchUnique(state, HashParams<Int64Type>{0}, state.range(0), state.range(1));
|
||||
}
|
||||
|
||||
static void BM_UniqueInt64WithNulls(benchmark::State& state) {
|
||||
static void UniqueInt64WithNulls(benchmark::State& state) {
|
||||
BenchUnique(state, HashParams<Int64Type>{0.05}, state.range(0), state.range(1));
|
||||
}
|
||||
|
||||
static void BM_UniqueString10bytes(benchmark::State& state) {
|
||||
static void UniqueString10bytes(benchmark::State& state) {
|
||||
// Byte strings with 10 bytes each
|
||||
BenchUnique(state, HashParams<StringType>{0.05, 10}, state.range(0), state.range(1));
|
||||
}
|
||||
|
||||
static void BM_UniqueString100bytes(benchmark::State& state) {
|
||||
static void UniqueString100bytes(benchmark::State& state) {
|
||||
// Byte strings with 100 bytes each
|
||||
BenchUnique(state, HashParams<StringType>{0.05, 100}, state.range(0), state.range(1));
|
||||
}
|
||||
|
||||
BENCHMARK(BM_BuildDictionary);
|
||||
BENCHMARK(BM_BuildStringDictionary);
|
||||
BENCHMARK(BuildDictionary);
|
||||
BENCHMARK(BuildStringDictionary);
|
||||
|
||||
constexpr int kHashBenchmarkLength = 1 << 22;
|
||||
|
||||
@@ -207,16 +207,16 @@ constexpr int kHashBenchmarkLength = 1 << 22;
|
||||
WHAT->Args({kHashBenchmarkLength, 1 << 10}) \
|
||||
->Args({kHashBenchmarkLength, 10 * 1 << 10}) \
|
||||
|
||||
ADD_HASH_ARGS(BENCHMARK(BM_UniqueInt64NoNulls));
|
||||
ADD_HASH_ARGS(BENCHMARK(BM_UniqueInt64WithNulls));
|
||||
ADD_HASH_ARGS(BENCHMARK(BM_UniqueString10bytes));
|
||||
ADD_HASH_ARGS(BENCHMARK(BM_UniqueString100bytes));
|
||||
ADD_HASH_ARGS(BENCHMARK(UniqueInt64NoNulls));
|
||||
ADD_HASH_ARGS(BENCHMARK(UniqueInt64WithNulls));
|
||||
ADD_HASH_ARGS(BENCHMARK(UniqueString10bytes));
|
||||
ADD_HASH_ARGS(BENCHMARK(UniqueString100bytes));
|
||||
|
||||
BENCHMARK(BM_UniqueUInt8NoNulls)
|
||||
BENCHMARK(UniqueUInt8NoNulls)
|
||||
->Args({kHashBenchmarkLength, 200})
|
||||
->Unit(benchmark::kMicrosecond);
|
||||
|
||||
BENCHMARK(BM_UniqueUInt8WithNulls)
|
||||
BENCHMARK(UniqueUInt8WithNulls)
|
||||
->Args({kHashBenchmarkLength, 200})
|
||||
->Unit(benchmark::kMicrosecond);
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ static void CudaBufferWriterBenchmark(benchmark::State& state, const int64_t tot
|
||||
state.SetBytesProcessed(int64_t(state.iterations()) * total_bytes);
|
||||
}
|
||||
|
||||
static void BM_Writer_Buffered(benchmark::State& state) {
|
||||
static void Writer_Buffered(benchmark::State& state) {
|
||||
// 128MB
|
||||
const int64_t kTotalBytes = 1 << 27;
|
||||
|
||||
@@ -75,19 +75,19 @@ static void BM_Writer_Buffered(benchmark::State& state) {
|
||||
CudaBufferWriterBenchmark(state, kTotalBytes, state.range(0), kBufferSize);
|
||||
}
|
||||
|
||||
static void BM_Writer_Unbuffered(benchmark::State& state) {
|
||||
static void Writer_Unbuffered(benchmark::State& state) {
|
||||
// 128MB
|
||||
const int64_t kTotalBytes = 1 << 27;
|
||||
CudaBufferWriterBenchmark(state, kTotalBytes, state.range(0), 0);
|
||||
}
|
||||
|
||||
// Vary chunk write size from 256 bytes to 64K
|
||||
BENCHMARK(BM_Writer_Buffered)
|
||||
BENCHMARK(Writer_Buffered)
|
||||
->RangeMultiplier(16)
|
||||
->Range(1 << 8, 1 << 16)
|
||||
->UseRealTime();
|
||||
|
||||
BENCHMARK(BM_Writer_Unbuffered)
|
||||
BENCHMARK(Writer_Unbuffered)
|
||||
->RangeMultiplier(4)
|
||||
->RangeMultiplier(16)
|
||||
->Range(1 << 8, 1 << 16)
|
||||
|
||||
@@ -155,7 +155,7 @@ static void BenchmarkStreamingWrites(benchmark::State& state,
|
||||
// This situation is irrealistic as the kernel likely doesn't
|
||||
// copy the data at all, so we only measure small writes.
|
||||
|
||||
static void BM_FileOutputStreamSmallWritesToNull(
|
||||
static void FileOutputStreamSmallWritesToNull(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
std::shared_ptr<io::OutputStream> stream;
|
||||
ABORT_NOT_OK(io::FileOutputStream::Open(GetNullFile(), &stream));
|
||||
@@ -163,7 +163,7 @@ static void BM_FileOutputStreamSmallWritesToNull(
|
||||
BenchmarkStreamingWrites(state, small_sizes, stream.get());
|
||||
}
|
||||
|
||||
static void BM_BufferedOutputStreamSmallWritesToNull(
|
||||
static void BufferedOutputStreamSmallWritesToNull(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
std::shared_ptr<io::OutputStream> file;
|
||||
ABORT_NOT_OK(io::FileOutputStream::Open(GetNullFile(), &file));
|
||||
@@ -178,7 +178,7 @@ static void BM_BufferedOutputStreamSmallWritesToNull(
|
||||
//
|
||||
// This is slightly more realistic than the above
|
||||
|
||||
static void BM_FileOutputStreamSmallWritesToPipe(
|
||||
static void FileOutputStreamSmallWritesToPipe(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
std::shared_ptr<io::OutputStream> stream;
|
||||
std::shared_ptr<BackgroundReader> reader;
|
||||
@@ -187,7 +187,7 @@ static void BM_FileOutputStreamSmallWritesToPipe(
|
||||
BenchmarkStreamingWrites(state, small_sizes, stream.get(), reader.get());
|
||||
}
|
||||
|
||||
static void BM_FileOutputStreamLargeWritesToPipe(
|
||||
static void FileOutputStreamLargeWritesToPipe(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
std::shared_ptr<io::OutputStream> stream;
|
||||
std::shared_ptr<BackgroundReader> reader;
|
||||
@@ -196,7 +196,7 @@ static void BM_FileOutputStreamLargeWritesToPipe(
|
||||
BenchmarkStreamingWrites(state, large_sizes, stream.get(), reader.get());
|
||||
}
|
||||
|
||||
static void BM_BufferedOutputStreamSmallWritesToPipe(
|
||||
static void BufferedOutputStreamSmallWritesToPipe(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
std::shared_ptr<io::OutputStream> stream;
|
||||
std::shared_ptr<BackgroundReader> reader;
|
||||
@@ -208,7 +208,7 @@ static void BM_BufferedOutputStreamSmallWritesToPipe(
|
||||
BenchmarkStreamingWrites(state, small_sizes, buffered_stream.get(), reader.get());
|
||||
}
|
||||
|
||||
static void BM_BufferedOutputStreamLargeWritesToPipe(
|
||||
static void BufferedOutputStreamLargeWritesToPipe(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
std::shared_ptr<io::OutputStream> stream;
|
||||
std::shared_ptr<BackgroundReader> reader;
|
||||
@@ -224,13 +224,13 @@ static void BM_BufferedOutputStreamLargeWritesToPipe(
|
||||
// We use real time as we don't want to count CPU time spent in the
|
||||
// BackgroundReader thread
|
||||
|
||||
BENCHMARK(BM_FileOutputStreamSmallWritesToNull)->UseRealTime();
|
||||
BENCHMARK(BM_FileOutputStreamSmallWritesToPipe)->UseRealTime();
|
||||
BENCHMARK(BM_FileOutputStreamLargeWritesToPipe)->UseRealTime();
|
||||
BENCHMARK(FileOutputStreamSmallWritesToNull)->UseRealTime();
|
||||
BENCHMARK(FileOutputStreamSmallWritesToPipe)->UseRealTime();
|
||||
BENCHMARK(FileOutputStreamLargeWritesToPipe)->UseRealTime();
|
||||
|
||||
BENCHMARK(BM_BufferedOutputStreamSmallWritesToNull)->UseRealTime();
|
||||
BENCHMARK(BM_BufferedOutputStreamSmallWritesToPipe)->UseRealTime();
|
||||
BENCHMARK(BM_BufferedOutputStreamLargeWritesToPipe)->UseRealTime();
|
||||
BENCHMARK(BufferedOutputStreamSmallWritesToNull)->UseRealTime();
|
||||
BENCHMARK(BufferedOutputStreamSmallWritesToPipe)->UseRealTime();
|
||||
BENCHMARK(BufferedOutputStreamLargeWritesToPipe)->UseRealTime();
|
||||
|
||||
#endif // ifndef _WIN32
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ std::shared_ptr<RecordBatch> MakeRecordBatch(int64_t total_size, int64_t num_fie
|
||||
return RecordBatch::Make(schema, length, arrays);
|
||||
}
|
||||
|
||||
static void BM_WriteRecordBatch(benchmark::State& state) { // NOLINT non-const reference
|
||||
static void WriteRecordBatch(benchmark::State& state) { // NOLINT non-const reference
|
||||
// 1MB
|
||||
constexpr int64_t kTotalSize = 1 << 20;
|
||||
|
||||
@@ -68,7 +68,7 @@ static void BM_WriteRecordBatch(benchmark::State& state) { // NOLINT non-const
|
||||
state.SetBytesProcessed(int64_t(state.iterations()) * kTotalSize);
|
||||
}
|
||||
|
||||
static void BM_ReadRecordBatch(benchmark::State& state) { // NOLINT non-const reference
|
||||
static void ReadRecordBatch(benchmark::State& state) { // NOLINT non-const reference
|
||||
// 1MB
|
||||
constexpr int64_t kTotalSize = 1 << 20;
|
||||
|
||||
@@ -99,7 +99,7 @@ static void BM_ReadRecordBatch(benchmark::State& state) { // NOLINT non-const r
|
||||
state.SetBytesProcessed(int64_t(state.iterations()) * kTotalSize);
|
||||
}
|
||||
|
||||
BENCHMARK(BM_WriteRecordBatch)->RangeMultiplier(4)->Range(1, 1 << 13)->UseRealTime();
|
||||
BENCHMARK(BM_ReadRecordBatch)->RangeMultiplier(4)->Range(1, 1 << 13)->UseRealTime();
|
||||
BENCHMARK(WriteRecordBatch)->RangeMultiplier(4)->Range(1, 1 << 13)->UseRealTime();
|
||||
BENCHMARK(ReadRecordBatch)->RangeMultiplier(4)->Range(1, 1 << 13)->UseRealTime();
|
||||
|
||||
} // namespace arrow
|
||||
@@ -111,7 +111,7 @@ int64_t StreamingCompress(Codec* codec, const std::vector<uint8_t>& data,
|
||||
return compressed_size;
|
||||
}
|
||||
|
||||
static void BM_StreamingCompression(
|
||||
static void StreamingCompression(
|
||||
Compression::type compression, const std::vector<uint8_t>& data,
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
std::unique_ptr<Codec> codec;
|
||||
@@ -126,14 +126,14 @@ static void BM_StreamingCompression(
|
||||
}
|
||||
|
||||
template <Compression::type COMPRESSION>
|
||||
static void BM_StreamingCompression(
|
||||
static void StreamingCompression(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
auto data = MakeCompressibleData(8 * 1024 * 1024); // 8 MB
|
||||
|
||||
BM_StreamingCompression(COMPRESSION, data, state);
|
||||
StreamingCompression(COMPRESSION, data, state);
|
||||
}
|
||||
|
||||
static void BM_StreamingDecompression(
|
||||
static void StreamingDecompression(
|
||||
Compression::type compression, const std::vector<uint8_t>& data,
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
std::unique_ptr<Codec> codec;
|
||||
@@ -173,22 +173,22 @@ static void BM_StreamingDecompression(
|
||||
}
|
||||
|
||||
template <Compression::type COMPRESSION>
|
||||
static void BM_StreamingDecompression(
|
||||
static void StreamingDecompression(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
auto data = MakeCompressibleData(8 * 1024 * 1024); // 8 MB
|
||||
|
||||
BM_StreamingDecompression(COMPRESSION, data, state);
|
||||
StreamingDecompression(COMPRESSION, data, state);
|
||||
}
|
||||
|
||||
BENCHMARK_TEMPLATE(BM_StreamingCompression, Compression::GZIP);
|
||||
BENCHMARK_TEMPLATE(BM_StreamingCompression, Compression::BROTLI);
|
||||
BENCHMARK_TEMPLATE(BM_StreamingCompression, Compression::ZSTD);
|
||||
BENCHMARK_TEMPLATE(BM_StreamingCompression, Compression::LZ4);
|
||||
BENCHMARK_TEMPLATE(StreamingCompression, Compression::GZIP);
|
||||
BENCHMARK_TEMPLATE(StreamingCompression, Compression::BROTLI);
|
||||
BENCHMARK_TEMPLATE(StreamingCompression, Compression::ZSTD);
|
||||
BENCHMARK_TEMPLATE(StreamingCompression, Compression::LZ4);
|
||||
|
||||
BENCHMARK_TEMPLATE(BM_StreamingDecompression, Compression::GZIP);
|
||||
BENCHMARK_TEMPLATE(BM_StreamingDecompression, Compression::BROTLI);
|
||||
BENCHMARK_TEMPLATE(BM_StreamingDecompression, Compression::ZSTD);
|
||||
BENCHMARK_TEMPLATE(BM_StreamingDecompression, Compression::LZ4);
|
||||
BENCHMARK_TEMPLATE(StreamingDecompression, Compression::GZIP);
|
||||
BENCHMARK_TEMPLATE(StreamingDecompression, Compression::BROTLI);
|
||||
BENCHMARK_TEMPLATE(StreamingDecompression, Compression::ZSTD);
|
||||
BENCHMARK_TEMPLATE(StreamingDecompression, Compression::LZ4);
|
||||
|
||||
} // namespace util
|
||||
} // namespace arrow
|
||||
@@ -26,7 +26,7 @@
|
||||
namespace arrow {
|
||||
namespace Decimal {
|
||||
|
||||
static void BM_FromString(benchmark::State& state) { // NOLINT non-const reference
|
||||
static void FromString(benchmark::State& state) { // NOLINT non-const reference
|
||||
std::vector<std::string> values = {"0", "1.23", "12.345e6", "-12.345e-6"};
|
||||
|
||||
while (state.KeepRunning()) {
|
||||
@@ -39,7 +39,7 @@ static void BM_FromString(benchmark::State& state) { // NOLINT non-const refere
|
||||
state.SetItemsProcessed(state.iterations() * values.size());
|
||||
}
|
||||
|
||||
BENCHMARK(BM_FromString);
|
||||
BENCHMARK(FromString);
|
||||
|
||||
} // namespace Decimal
|
||||
} // namespace arrow
|
||||
@@ -62,7 +62,7 @@ static std::vector<std::string> MakeStrings(int32_t n_values, int32_t min_length
|
||||
return values;
|
||||
}
|
||||
|
||||
static void BM_HashIntegers(benchmark::State& state) { // NOLINT non-const reference
|
||||
static void HashIntegers(benchmark::State& state) { // NOLINT non-const reference
|
||||
const std::vector<int64_t> values = MakeIntegers<int64_t>(10000);
|
||||
|
||||
while (state.KeepRunning()) {
|
||||
@@ -96,17 +96,17 @@ static void BenchmarkStringHashing(benchmark::State& state, // NOLINT non-const
|
||||
state.SetItemsProcessed(2 * state.iterations() * values.size());
|
||||
}
|
||||
|
||||
static void BM_HashSmallStrings(benchmark::State& state) { // NOLINT non-const reference
|
||||
static void HashSmallStrings(benchmark::State& state) { // NOLINT non-const reference
|
||||
const std::vector<std::string> values = MakeStrings(10000, 2, 20);
|
||||
BenchmarkStringHashing(state, values);
|
||||
}
|
||||
|
||||
static void BM_HashMediumStrings(benchmark::State& state) { // NOLINT non-const reference
|
||||
static void HashMediumStrings(benchmark::State& state) { // NOLINT non-const reference
|
||||
const std::vector<std::string> values = MakeStrings(10000, 20, 120);
|
||||
BenchmarkStringHashing(state, values);
|
||||
}
|
||||
|
||||
static void BM_HashLargeStrings(benchmark::State& state) { // NOLINT non-const reference
|
||||
static void HashLargeStrings(benchmark::State& state) { // NOLINT non-const reference
|
||||
const std::vector<std::string> values = MakeStrings(1000, 120, 2000);
|
||||
BenchmarkStringHashing(state, values);
|
||||
}
|
||||
@@ -114,10 +114,10 @@ static void BM_HashLargeStrings(benchmark::State& state) { // NOLINT non-const
|
||||
// ----------------------------------------------------------------------
|
||||
// Benchmark declarations
|
||||
|
||||
BENCHMARK(BM_HashIntegers);
|
||||
BENCHMARK(BM_HashSmallStrings);
|
||||
BENCHMARK(BM_HashMediumStrings);
|
||||
BENCHMARK(BM_HashLargeStrings);
|
||||
BENCHMARK(HashIntegers);
|
||||
BENCHMARK(HashSmallStrings);
|
||||
BENCHMARK(HashMediumStrings);
|
||||
BENCHMARK(HashLargeStrings);
|
||||
|
||||
} // namespace internal
|
||||
} // namespace arrow
|
||||
@@ -49,7 +49,7 @@ std::vector<uint8_t> GetValidBytes(int n_values) {
|
||||
return valid_bytes;
|
||||
}
|
||||
|
||||
static void BM_DetectUIntWidthNoNulls(
|
||||
static void DetectUIntWidthNoNulls(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
const auto values = GetUIntSequence(0x12345);
|
||||
|
||||
@@ -60,7 +60,7 @@ static void BM_DetectUIntWidthNoNulls(
|
||||
state.SetBytesProcessed(state.iterations() * values.size() * sizeof(uint64_t));
|
||||
}
|
||||
|
||||
static void BM_DetectUIntWidthNulls(
|
||||
static void DetectUIntWidthNulls(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
const auto values = GetUIntSequence(0x12345);
|
||||
const auto valid_bytes = GetValidBytes(0x12345);
|
||||
@@ -73,7 +73,7 @@ static void BM_DetectUIntWidthNulls(
|
||||
state.SetBytesProcessed(state.iterations() * values.size() * sizeof(uint64_t));
|
||||
}
|
||||
|
||||
static void BM_DetectIntWidthNoNulls(
|
||||
static void DetectIntWidthNoNulls(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
const auto values = GetIntSequence(0x12345, -0x1234);
|
||||
|
||||
@@ -84,7 +84,7 @@ static void BM_DetectIntWidthNoNulls(
|
||||
state.SetBytesProcessed(state.iterations() * values.size() * sizeof(uint64_t));
|
||||
}
|
||||
|
||||
static void BM_DetectIntWidthNulls(
|
||||
static void DetectIntWidthNulls(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
const auto values = GetIntSequence(0x12345, -0x1234);
|
||||
const auto valid_bytes = GetValidBytes(0x12345);
|
||||
@@ -97,10 +97,10 @@ static void BM_DetectIntWidthNulls(
|
||||
state.SetBytesProcessed(state.iterations() * values.size() * sizeof(uint64_t));
|
||||
}
|
||||
|
||||
BENCHMARK(BM_DetectUIntWidthNoNulls);
|
||||
BENCHMARK(BM_DetectUIntWidthNulls);
|
||||
BENCHMARK(BM_DetectIntWidthNoNulls);
|
||||
BENCHMARK(BM_DetectIntWidthNulls);
|
||||
BENCHMARK(DetectUIntWidthNoNulls);
|
||||
BENCHMARK(DetectUIntWidthNulls);
|
||||
BENCHMARK(DetectIntWidthNoNulls);
|
||||
BENCHMARK(DetectIntWidthNulls);
|
||||
|
||||
} // namespace internal
|
||||
} // namespace arrow
|
||||
@@ -39,7 +39,7 @@ std::vector<T> generate_junk(int64_t size) {
|
||||
}
|
||||
|
||||
// Baseline
|
||||
void BM_for_loop(benchmark::State& state) {
|
||||
void for_loop(benchmark::State& state) {
|
||||
auto source = generate_junk(kSize);
|
||||
std::vector<int> target(kSize);
|
||||
|
||||
@@ -48,10 +48,10 @@ void BM_for_loop(benchmark::State& state) {
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(BM_for_loop);
|
||||
BENCHMARK(for_loop);
|
||||
|
||||
// For comparison: pure copy without any changes
|
||||
void BM_std_copy(benchmark::State& state) {
|
||||
void std_copy(benchmark::State& state) {
|
||||
auto source = generate_junk(kSize);
|
||||
std::vector<int> target(kSize);
|
||||
|
||||
@@ -60,10 +60,10 @@ void BM_std_copy(benchmark::State& state) {
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(BM_std_copy);
|
||||
BENCHMARK(std_copy);
|
||||
|
||||
// For comparison: pure copy with type convesion.
|
||||
void BM_std_copy_converting(benchmark::State& state) {
|
||||
void std_copy_converting(benchmark::State& state) {
|
||||
auto source = generate_junk<int32_t>(kSize);
|
||||
// bigger type to avoid warnings
|
||||
std::vector<int64_t> target(kSize);
|
||||
@@ -73,10 +73,10 @@ void BM_std_copy_converting(benchmark::State& state) {
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(BM_std_copy_converting);
|
||||
BENCHMARK(std_copy_converting);
|
||||
|
||||
// std::copy with a lazy range as a source
|
||||
void BM_lazy_copy(benchmark::State& state) {
|
||||
void lazy_copy(benchmark::State& state) {
|
||||
auto source = generate_junk(kSize);
|
||||
std::vector<int> target(kSize);
|
||||
auto lazy_range = internal::MakeLazyRange(
|
||||
@@ -87,11 +87,11 @@ void BM_lazy_copy(benchmark::State& state) {
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(BM_lazy_copy);
|
||||
BENCHMARK(lazy_copy);
|
||||
|
||||
// std::copy with a lazy range which does static cast.
|
||||
// Should be the same performance as std::copy with differtly typed iterators
|
||||
void BM_lazy_copy_converting(benchmark::State& state) {
|
||||
void lazy_copy_converting(benchmark::State& state) {
|
||||
auto source = generate_junk<int64_t>(kSize);
|
||||
std::vector<int32_t> target(kSize);
|
||||
auto lazy_range = internal::MakeLazyRange(
|
||||
@@ -103,10 +103,10 @@ void BM_lazy_copy_converting(benchmark::State& state) {
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(BM_lazy_copy_converting);
|
||||
BENCHMARK(lazy_copy_converting);
|
||||
|
||||
// For loop with a post-increment of a lazy operator
|
||||
void BM_lazy_postinc(benchmark::State& state) {
|
||||
void lazy_postinc(benchmark::State& state) {
|
||||
auto source = generate_junk(kSize);
|
||||
std::vector<int> target(kSize);
|
||||
auto lazy_range = internal::MakeLazyRange(
|
||||
@@ -121,7 +121,7 @@ void BM_lazy_postinc(benchmark::State& state) {
|
||||
}
|
||||
}
|
||||
|
||||
BENCHMARK(BM_lazy_postinc);
|
||||
BENCHMARK(lazy_postinc);
|
||||
|
||||
#endif // ARROW_WITH_BENCHMARKS_REFERENCE
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ std::vector<int32_t> RandomPath(int32_t size) {
|
||||
}
|
||||
|
||||
// Cache / main memory latency, depending on the working set size
|
||||
static void BM_memory_latency(benchmark::State& state) {
|
||||
static void memory_latency(benchmark::State& state) {
|
||||
const auto niters = static_cast<int32_t>(state.range(0));
|
||||
const std::vector<int32_t> path = RandomPath(niters / 4);
|
||||
|
||||
@@ -67,7 +67,7 @@ static void BM_memory_latency(benchmark::State& state) {
|
||||
state.SetItemsProcessed(state.iterations());
|
||||
}
|
||||
|
||||
BENCHMARK(BM_memory_latency)->Repetitions(1)->RangeMultiplier(2)->Range(2 << 10, 2 << 24);
|
||||
BENCHMARK(memory_latency)->Repetitions(1)->RangeMultiplier(2)->Range(2 << 10, 2 << 24);
|
||||
|
||||
#endif // ARROW_WITH_BENCHMARKS_REFERENCE
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ static std::vector<std::string> MakeTimestampStrings(int32_t num_items) {
|
||||
}
|
||||
|
||||
template <typename ARROW_TYPE, typename C_TYPE = typename ARROW_TYPE::c_type>
|
||||
static void BM_IntegerParsing(benchmark::State& state) { // NOLINT non-const reference
|
||||
static void IntegerParsing(benchmark::State& state) { // NOLINT non-const reference
|
||||
auto strings = MakeIntStrings<C_TYPE>(1000);
|
||||
StringConverter<ARROW_TYPE> converter;
|
||||
|
||||
@@ -89,7 +89,7 @@ static void BM_IntegerParsing(benchmark::State& state) { // NOLINT non-const re
|
||||
}
|
||||
|
||||
template <typename ARROW_TYPE, typename C_TYPE = typename ARROW_TYPE::c_type>
|
||||
static void BM_FloatParsing(benchmark::State& state) { // NOLINT non-const reference
|
||||
static void FloatParsing(benchmark::State& state) { // NOLINT non-const reference
|
||||
auto strings = MakeFloatStrings(1000);
|
||||
StringConverter<ARROW_TYPE> converter;
|
||||
|
||||
@@ -109,7 +109,7 @@ static void BM_FloatParsing(benchmark::State& state) { // NOLINT non-const refe
|
||||
}
|
||||
|
||||
template <TimeUnit::type UNIT>
|
||||
static void BM_TimestampParsing(benchmark::State& state) { // NOLINT non-const reference
|
||||
static void TimestampParsing(benchmark::State& state) { // NOLINT non-const reference
|
||||
using c_type = TimestampType::c_type;
|
||||
|
||||
auto strings = MakeTimestampStrings(1000);
|
||||
@@ -131,22 +131,22 @@ static void BM_TimestampParsing(benchmark::State& state) { // NOLINT non-const
|
||||
state.SetItemsProcessed(state.iterations() * strings.size());
|
||||
}
|
||||
|
||||
BENCHMARK_TEMPLATE(BM_IntegerParsing, Int8Type);
|
||||
BENCHMARK_TEMPLATE(BM_IntegerParsing, Int16Type);
|
||||
BENCHMARK_TEMPLATE(BM_IntegerParsing, Int32Type);
|
||||
BENCHMARK_TEMPLATE(BM_IntegerParsing, Int64Type);
|
||||
BENCHMARK_TEMPLATE(BM_IntegerParsing, UInt8Type);
|
||||
BENCHMARK_TEMPLATE(BM_IntegerParsing, UInt16Type);
|
||||
BENCHMARK_TEMPLATE(BM_IntegerParsing, UInt32Type);
|
||||
BENCHMARK_TEMPLATE(BM_IntegerParsing, UInt64Type);
|
||||
BENCHMARK_TEMPLATE(IntegerParsing, Int8Type);
|
||||
BENCHMARK_TEMPLATE(IntegerParsing, Int16Type);
|
||||
BENCHMARK_TEMPLATE(IntegerParsing, Int32Type);
|
||||
BENCHMARK_TEMPLATE(IntegerParsing, Int64Type);
|
||||
BENCHMARK_TEMPLATE(IntegerParsing, UInt8Type);
|
||||
BENCHMARK_TEMPLATE(IntegerParsing, UInt16Type);
|
||||
BENCHMARK_TEMPLATE(IntegerParsing, UInt32Type);
|
||||
BENCHMARK_TEMPLATE(IntegerParsing, UInt64Type);
|
||||
|
||||
BENCHMARK_TEMPLATE(BM_FloatParsing, FloatType);
|
||||
BENCHMARK_TEMPLATE(BM_FloatParsing, DoubleType);
|
||||
BENCHMARK_TEMPLATE(FloatParsing, FloatType);
|
||||
BENCHMARK_TEMPLATE(FloatParsing, DoubleType);
|
||||
|
||||
BENCHMARK_TEMPLATE(BM_TimestampParsing, TimeUnit::SECOND);
|
||||
BENCHMARK_TEMPLATE(BM_TimestampParsing, TimeUnit::MILLI);
|
||||
BENCHMARK_TEMPLATE(BM_TimestampParsing, TimeUnit::MICRO);
|
||||
BENCHMARK_TEMPLATE(BM_TimestampParsing, TimeUnit::NANO);
|
||||
BENCHMARK_TEMPLATE(TimestampParsing, TimeUnit::SECOND);
|
||||
BENCHMARK_TEMPLATE(TimestampParsing, TimeUnit::MILLI);
|
||||
BENCHMARK_TEMPLATE(TimestampParsing, TimeUnit::MICRO);
|
||||
BENCHMARK_TEMPLATE(TimestampParsing, TimeUnit::NANO);
|
||||
|
||||
} // namespace internal
|
||||
} // namespace arrow
|
||||
@@ -75,8 +75,8 @@ struct Task {
|
||||
|
||||
// This benchmark simply provides a baseline indicating the raw cost of our workload
|
||||
// depending on the workload size. Number of items / second in this (serial)
|
||||
// benchmark can be compared to the numbers obtained in BM_ThreadPoolSpawn.
|
||||
static void BM_WorkloadCost(benchmark::State& state) {
|
||||
// benchmark can be compared to the numbers obtained in ThreadPoolSpawn.
|
||||
static void WorkloadCost(benchmark::State& state) {
|
||||
const auto workload_size = static_cast<int32_t>(state.range(0));
|
||||
|
||||
Workload workload(workload_size);
|
||||
@@ -88,7 +88,7 @@ static void BM_WorkloadCost(benchmark::State& state) {
|
||||
}
|
||||
|
||||
// Benchmark ThreadPool::Spawn
|
||||
static void BM_ThreadPoolSpawn(benchmark::State& state) {
|
||||
static void ThreadPoolSpawn(benchmark::State& state) {
|
||||
const auto nthreads = static_cast<int>(state.range(0));
|
||||
const auto workload_size = static_cast<int32_t>(state.range(1));
|
||||
|
||||
@@ -118,7 +118,7 @@ static void BM_ThreadPoolSpawn(benchmark::State& state) {
|
||||
}
|
||||
|
||||
// Benchmark serial TaskGroup
|
||||
static void BM_SerialTaskGroup(benchmark::State& state) {
|
||||
static void SerialTaskGroup(benchmark::State& state) {
|
||||
const auto workload_size = static_cast<int32_t>(state.range(0));
|
||||
|
||||
Task task(workload_size);
|
||||
@@ -137,7 +137,7 @@ static void BM_SerialTaskGroup(benchmark::State& state) {
|
||||
}
|
||||
|
||||
// Benchmark threaded TaskGroup
|
||||
static void BM_ThreadedTaskGroup(benchmark::State& state) {
|
||||
static void ThreadedTaskGroup(benchmark::State& state) {
|
||||
const auto nthreads = static_cast<int>(state.range(0));
|
||||
const auto workload_size = static_cast<int32_t>(state.range(1));
|
||||
|
||||
@@ -183,10 +183,10 @@ static void ThreadPoolSpawn_Customize(benchmark::internal::Benchmark* b) {
|
||||
b->Repetitions(1);
|
||||
}
|
||||
|
||||
BENCHMARK(BM_WorkloadCost)->Apply(WorkloadCost_Customize);
|
||||
BENCHMARK(BM_SerialTaskGroup)->Apply(WorkloadCost_Customize);
|
||||
BENCHMARK(BM_ThreadPoolSpawn)->Apply(ThreadPoolSpawn_Customize);
|
||||
BENCHMARK(BM_ThreadedTaskGroup)->Apply(ThreadPoolSpawn_Customize);
|
||||
BENCHMARK(WorkloadCost)->Apply(WorkloadCost_Customize);
|
||||
BENCHMARK(SerialTaskGroup)->Apply(WorkloadCost_Customize);
|
||||
BENCHMARK(ThreadPoolSpawn)->Apply(ThreadPoolSpawn_Customize);
|
||||
BENCHMARK(ThreadedTaskGroup)->Apply(ThreadPoolSpawn_Customize);
|
||||
|
||||
} // namespace internal
|
||||
} // namespace arrow
|
||||
@@ -191,29 +191,29 @@ static void BenchmarkInlinedTrieLookups(
|
||||
state.SetItemsProcessed(state.iterations() * lookups.size());
|
||||
}
|
||||
|
||||
static void BM_TrieLookupFound(benchmark::State& state) { // NOLINT non-const reference
|
||||
static void TrieLookupFound(benchmark::State& state) { // NOLINT non-const reference
|
||||
BenchmarkTrieLookups(state, {"N/A", "null", "-1.#IND", "N/A"});
|
||||
}
|
||||
|
||||
static void BM_TrieLookupNotFound(
|
||||
static void TrieLookupNotFound(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
BenchmarkTrieLookups(state, {"None", "1.0", "", "abc"});
|
||||
}
|
||||
|
||||
static void BM_InlinedTrieLookupFound(
|
||||
static void InlinedTrieLookupFound(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
BenchmarkInlinedTrieLookups(state, {"N/A", "null", "-1.#IND", "N/A"});
|
||||
}
|
||||
|
||||
static void BM_InlinedTrieLookupNotFound(
|
||||
static void InlinedTrieLookupNotFound(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
BenchmarkInlinedTrieLookups(state, {"None", "1.0", "", "abc"});
|
||||
}
|
||||
|
||||
BENCHMARK(BM_TrieLookupFound);
|
||||
BENCHMARK(BM_TrieLookupNotFound);
|
||||
BENCHMARK(BM_InlinedTrieLookupFound);
|
||||
BENCHMARK(BM_InlinedTrieLookupNotFound);
|
||||
BENCHMARK(TrieLookupFound);
|
||||
BENCHMARK(TrieLookupNotFound);
|
||||
BENCHMARK(InlinedTrieLookupFound);
|
||||
BENCHMARK(InlinedTrieLookupNotFound);
|
||||
|
||||
} // namespace internal
|
||||
} // namespace arrow
|
||||
@@ -70,55 +70,55 @@ static void BenchmarkUTF8Validation(
|
||||
state.SetBytesProcessed(state.iterations() * s.size());
|
||||
}
|
||||
|
||||
static void BM_ValidateTinyAscii(benchmark::State& state) { // NOLINT non-const reference
|
||||
static void ValidateTinyAscii(benchmark::State& state) { // NOLINT non-const reference
|
||||
BenchmarkUTF8Validation(state, tiny_valid_ascii, true);
|
||||
}
|
||||
|
||||
static void BM_ValidateTinyNonAscii(
|
||||
static void ValidateTinyNonAscii(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
BenchmarkUTF8Validation(state, tiny_valid_non_ascii, true);
|
||||
}
|
||||
|
||||
static void BM_ValidateSmallAscii(
|
||||
static void ValidateSmallAscii(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
BenchmarkUTF8Validation(state, valid_ascii, true); }
|
||||
|
||||
static void BM_ValidateSmallAlmostAscii(
|
||||
static void ValidateSmallAlmostAscii(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
BenchmarkUTF8Validation(state, valid_almost_ascii, true);
|
||||
}
|
||||
|
||||
static void BM_ValidateSmallNonAscii(
|
||||
static void ValidateSmallNonAscii(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
BenchmarkUTF8Validation(state, valid_non_ascii, true);
|
||||
}
|
||||
|
||||
static void BM_ValidateLargeAscii(
|
||||
static void ValidateLargeAscii(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
auto s = MakeLargeString(valid_ascii, 100000);
|
||||
BenchmarkUTF8Validation(state, s, true);
|
||||
}
|
||||
|
||||
static void BM_ValidateLargeAlmostAscii(
|
||||
static void ValidateLargeAlmostAscii(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
auto s = MakeLargeString(valid_almost_ascii, 100000);
|
||||
BenchmarkUTF8Validation(state, s, true);
|
||||
}
|
||||
|
||||
static void BM_ValidateLargeNonAscii(
|
||||
static void ValidateLargeNonAscii(
|
||||
benchmark::State& state) { // NOLINT non-const reference
|
||||
auto s = MakeLargeString(valid_non_ascii, 100000);
|
||||
BenchmarkUTF8Validation(state, s, true);
|
||||
}
|
||||
|
||||
BENCHMARK(BM_ValidateTinyAscii);
|
||||
BENCHMARK(BM_ValidateTinyNonAscii);
|
||||
BENCHMARK(BM_ValidateSmallAscii);
|
||||
BENCHMARK(BM_ValidateSmallAlmostAscii);
|
||||
BENCHMARK(BM_ValidateSmallNonAscii);
|
||||
BENCHMARK(BM_ValidateLargeAscii);
|
||||
BENCHMARK(BM_ValidateLargeAlmostAscii);
|
||||
BENCHMARK(BM_ValidateLargeNonAscii);
|
||||
BENCHMARK(ValidateTinyAscii);
|
||||
BENCHMARK(ValidateTinyNonAscii);
|
||||
BENCHMARK(ValidateSmallAscii);
|
||||
BENCHMARK(ValidateSmallAlmostAscii);
|
||||
BENCHMARK(ValidateSmallNonAscii);
|
||||
BENCHMARK(ValidateLargeAscii);
|
||||
BENCHMARK(ValidateLargeAlmostAscii);
|
||||
BENCHMARK(ValidateLargeNonAscii);
|
||||
|
||||
} // namespace util
|
||||
} // namespace arrow
|
||||
Reference in new issue
Block a user