-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: use buffer for VarBinView views #1121
Closed
Closed
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
84e40de
feat: use buffer for VarBinView views
a10y ccee372
fix logic (no offset needed)
a10y 3756acf
dtype
a10y 64e0795
validity
a10y 53b9f4d
enforce views buffer is aligned on construction
a10y 8d3ed4d
remove specialized canonicalize, just use take
a10y 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
There are no files selected for viewing
This file contains 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 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,34 @@ | ||
#![allow(clippy::unwrap_used)] | ||
|
||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
use vortex::array::VarBinArray; | ||
use vortex::{IntoArray, IntoCanonical}; | ||
use vortex_dict::{dict_encode_varbin, DictArray}; | ||
use vortex_dtype::{DType, Nullability}; | ||
|
||
fn fixture(len: usize) -> DictArray { | ||
let values = [ | ||
Some("inlined"), | ||
None, | ||
Some("not inlined but repeated often"), | ||
]; | ||
|
||
let strings = VarBinArray::from_iter( | ||
values.into_iter().cycle().take(len), | ||
DType::Utf8(Nullability::Nullable), | ||
); | ||
|
||
let (codes, values) = dict_encode_varbin(&strings); | ||
DictArray::try_new(codes.into_array(), values.into_array()).unwrap() | ||
} | ||
|
||
fn bench_canonical(c: &mut Criterion) { | ||
let dict_array = fixture(1024).into_array(); | ||
|
||
c.bench_function("canonical", |b| { | ||
b.iter(|| dict_array.clone().into_canonical().unwrap()) | ||
}); | ||
} | ||
|
||
criterion_group!(bench_dict_canonical, bench_canonical); | ||
criterion_main!(bench_dict_canonical); |
This file contains 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 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 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 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 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 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess
into_varbinview()
runs a canonicalize internally? The name of this function doesn't scream quite how expensive it is I think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We made #507. Per https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv this should likely be
to_varbinview()
but also since this is owned -> owned conversion the docs suggestinto_
, however,to_
in Rust is meant to indicate expensive conversions