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

Function DecodeStream

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

Source from the content-addressed store, hash-verified

155}
156
157static void DecodeStream(benchmark::State& state) { // NOLINT non-const reference
158 // 1MB
159 constexpr int64_t kTotalSize = 1 << 20;
160 auto options = ipc::IpcWriteOptions::Defaults();
161
162 std::shared_ptr<ResizableBuffer> buffer = *AllocateResizableBuffer(1024);
163 auto record_batch = MakeRecordBatch(kTotalSize, state.range(0));
164
165 io::BufferOutputStream stream(buffer);
166
167 auto writer_result = ipc::MakeStreamWriter(&stream, record_batch->schema(), options);
168 ABORT_NOT_OK(writer_result);
169 auto writer = *writer_result;
170 ABORT_NOT_OK(writer->WriteRecordBatch(*record_batch));
171 ABORT_NOT_OK(writer->Close());
172
173 ipc::DictionaryMemo empty_memo;
174 while (state.KeepRunning()) {
175 class NullListener : public ipc::Listener {
176 Status OnRecordBatchDecoded(std::shared_ptr<RecordBatch> batch) override {
177 return Status::OK();
178 }
179 } listener;
180 ipc::StreamDecoder decoder(std::shared_ptr<NullListener>(&listener, [](void*) {}),
181 ipc::IpcReadOptions::Defaults());
182 ABORT_NOT_OK(decoder.Consume(buffer));
183 }
184 state.SetBytesProcessed(int64_t(state.iterations()) * kTotalSize);
185}
186
187#ifdef ARROW_WITH_ZSTD
188# define GENERATE_COMPRESSED_DATA_IN_MEMORY() \

Callers

nothing calls this directly

Calls 8

AllocateResizableBufferFunction · 0.85
MakeStreamWriterFunction · 0.85
MakeRecordBatchFunction · 0.70
DefaultsFunction · 0.50
schemaMethod · 0.45
WriteRecordBatchMethod · 0.45
CloseMethod · 0.45
ConsumeMethod · 0.45

Tested by

no test coverage detected