MCPcopy Create free account
hub / github.com/apache/arrow / WriteRecordBatch

Function WriteRecordBatch

cpp/src/arrow/ipc/read_write_benchmark.cc:77–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77static void WriteRecordBatch(benchmark::State& state) { // NOLINT non-const reference
78 // 1MB
79 constexpr int64_t kTotalSize = 1 << 20;
80 auto options = ipc::IpcWriteOptions::Defaults();
81
82 std::shared_ptr<ResizableBuffer> buffer = *AllocateResizableBuffer(1024);
83 auto record_batch = MakeRecordBatch(kTotalSize, state.range(0));
84
85 while (state.KeepRunning()) {
86 io::BufferOutputStream stream(buffer);
87 int32_t metadata_length;
88 int64_t body_length;
89 ABORT_NOT_OK(ipc::WriteRecordBatch(*record_batch, 0, &stream, &metadata_length,
90 &body_length, options));
91 }
92 state.SetBytesProcessed(int64_t(state.iterations()) * kTotalSize);
93}
94
95static void ReadRecordBatch(benchmark::State& state) { // NOLINT non-const reference
96 // 1MB

Callers 1

ReadRecordBatchFunction · 0.70

Calls 3

AllocateResizableBufferFunction · 0.85
MakeRecordBatchFunction · 0.70
DefaultsFunction · 0.50

Tested by

no test coverage detected