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

Function ReadRecordBatch

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

Source from the content-addressed store, hash-verified

93}
94
95static void ReadRecordBatch(benchmark::State& state) { // NOLINT non-const reference
96 // 1MB
97 constexpr int64_t kTotalSize = 1 << 20;
98 auto options = ipc::IpcWriteOptions::Defaults();
99
100 std::shared_ptr<ResizableBuffer> buffer = *AllocateResizableBuffer(1024);
101 auto record_batch = MakeRecordBatch(kTotalSize, state.range(0));
102
103 io::BufferOutputStream stream(buffer);
104
105 int32_t metadata_length;
106 int64_t body_length;
107 ABORT_NOT_OK(ipc::WriteRecordBatch(*record_batch, 0, &stream, &metadata_length,
108 &body_length, options));
109
110 ipc::DictionaryMemo empty_memo;
111 while (state.KeepRunning()) {
112 io::BufferReader reader(buffer);
113 ABORT_NOT_OK(ipc::ReadRecordBatch(record_batch->schema(), &empty_memo,
114 ipc::IpcReadOptions::Defaults(), &reader));
115 }
116 state.SetBytesProcessed(int64_t(state.iterations()) * kTotalSize);
117}
118
119static void ReadStream(benchmark::State& state) { // NOLINT non-const reference
120 // 1MB

Callers

nothing calls this directly

Calls 5

AllocateResizableBufferFunction · 0.85
MakeRecordBatchFunction · 0.70
WriteRecordBatchFunction · 0.70
DefaultsFunction · 0.50
schemaMethod · 0.45

Tested by

no test coverage detected