-
Notifications
You must be signed in to change notification settings - Fork 210
feat(bench): add Arrow IPC benchmark baselines #9624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lwwmanning
wants to merge
8
commits into
develop
Choose a base branch
from
wm/arrow-benchmarks
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
02ec38b
feat: add Arrow benchmark baselines
lwwmanning ee307ac
fix(bench): distinguish Arrow IPC from logical bytes
lwwmanning 2da9456
fix(bench): address Arrow benchmark review
lwwmanning e32bd29
Merge remote-tracking branch 'origin/develop' into wm/arrow-benchmarks
lwwmanning dc5e565
fix(bench): emit Arrow IPC throughput timings
lwwmanning 1b99c03
refactor(bench): separate reopen timing fix
lwwmanning fb52b57
style(python): format compression size fields
lwwmanning 6a5a606
fix(bench): serialize Arrow IPC compression timings
lwwmanning File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // SPDX-FileCopyrightText: Copyright the Vortex contributors | ||
|
|
||
| use std::fs::File; | ||
| use std::io::Cursor; | ||
| use std::path::Path; | ||
| use std::sync::Arc; | ||
| use std::time::Duration; | ||
| use std::time::Instant; | ||
|
|
||
| use arrow_array::RecordBatch; | ||
| use arrow_ipc::reader::FileReader; | ||
| use arrow_ipc::writer::FileWriter; | ||
| use arrow_schema::Schema; | ||
| use async_trait::async_trait; | ||
| use bytes::Bytes; | ||
| use parquet::arrow::arrow_reader::ParquetRecordBatchReaderBuilder; | ||
| use vortex_bench::Format; | ||
| use vortex_bench::compress::Compressor; | ||
| use vortex_bench::compress::read_projection; | ||
|
|
||
| /// Uncompressed Arrow IPC file baseline. | ||
| pub struct ArrowIpcCompressor; | ||
|
|
||
| #[async_trait] | ||
| impl Compressor for ArrowIpcCompressor { | ||
| fn format(&self) -> Format { | ||
| Format::ArrowIpc | ||
| } | ||
|
|
||
| async fn compress(&self, parquet_path: &Path) -> anyhow::Result<(u64, Duration)> { | ||
| let file = File::open(parquet_path)?; | ||
| let builder = ParquetRecordBatchReaderBuilder::try_new(file)?; | ||
| let schema = Arc::clone(builder.schema()); | ||
| let batches = builder.build()?.collect::<Result<Vec<_>, _>>()?; | ||
|
|
||
| let mut buf = Vec::new(); | ||
| let start = Instant::now(); | ||
| arrow_file_write(&mut buf, &schema, &batches)?; | ||
| let elapsed = start.elapsed(); | ||
| Ok((buf.len() as u64, elapsed)) | ||
| } | ||
|
|
||
| async fn decompress(&self, parquet_path: &Path) -> anyhow::Result<Duration> { | ||
| let file = File::open(parquet_path)?; | ||
| let builder = ParquetRecordBatchReaderBuilder::try_new(file)?; | ||
| let schema = Arc::clone(builder.schema()); | ||
| let batches = builder.build()?.collect::<Result<Vec<_>, _>>()?; | ||
|
|
||
| let mut buf = Vec::new(); | ||
| arrow_file_write(&mut buf, &schema, &batches)?; | ||
|
|
||
| let start = Instant::now(); | ||
| arrow_file_read(Bytes::from(buf), schema.fields().len())?; | ||
| Ok(start.elapsed()) | ||
| } | ||
| } | ||
|
|
||
| #[inline(never)] | ||
| fn arrow_file_write( | ||
| buf: &mut Vec<u8>, | ||
| schema: &Schema, | ||
| batches: &[RecordBatch], | ||
| ) -> anyhow::Result<()> { | ||
| let mut writer = FileWriter::try_new(buf, schema)?; | ||
| for batch in batches { | ||
| writer.write(batch)?; | ||
| } | ||
| writer.finish()?; | ||
| Ok(()) | ||
| } | ||
|
|
||
| #[inline(never)] | ||
| fn arrow_file_read(buf: Bytes, root_columns: usize) -> anyhow::Result<usize> { | ||
| let cursor = Cursor::new(buf); | ||
| let projection = read_projection(root_columns).map(<[usize]>::to_vec); | ||
| let reader = FileReader::try_new(cursor, projection)?; | ||
|
|
||
| let mut nbytes = 0; | ||
| for batch in reader { | ||
| nbytes += batch?.get_array_memory_size(); | ||
| } | ||
| Ok(nbytes) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.