-
Notifications
You must be signed in to change notification settings - Fork 121
feat: teach RunEndArray NullCount and TrueCount #2007
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
Merged
Merged
Changes from 10 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
f051a28
feat: teach RunEndArray NullCount and TrueCount
danking af059cd
benchmark
danking ec18568
fixes and fewer desnities
danking 4ed455e
iterate the indices
danking edc2bc2
always iterate the validity
danking e1bb680
extract runend statistics into functions
danking 687b3b1
cleanup
danking 7501df6
smaller diff
danking e59c5b6
smaller diff
danking 87fd08f
fixed up
danking e76d1a5
move statistics out
danking 7bba207
bind the end
danking b24b7b7
typed functions instead of macro code
danking 10d5e30
Convert from to into (#2052)
robert3005 a247149
more
robert3005 a3ccf4b
fix
robert3005 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| #![allow(clippy::unwrap_used)] | ||
|
|
||
| use std::iter::Iterator; | ||
|
|
||
| use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
| use rand::rngs::StdRng; | ||
| use rand::{Rng, SeedableRng as _}; | ||
| use vortex_array::array::PrimitiveArray; | ||
| use vortex_array::stats::Stat; | ||
| use vortex_array::IntoArrayData; | ||
| use vortex_buffer::Buffer; | ||
| use vortex_runend::RunEndArray; | ||
|
|
||
| const LENS: [usize; 2] = [1000, 100_000]; | ||
|
|
||
| /// Create RunEnd arrays where the runs are equal size, and the null_count mask is evenly spaced. | ||
| fn run_end_null_count(c: &mut Criterion) { | ||
| let mut rng = StdRng::seed_from_u64(0); | ||
| let mut group = c.benchmark_group("run_end_null_count"); | ||
|
|
||
| for &n in LENS.iter().rev() { | ||
| for run_step in [1usize << 2, 1 << 4, 1 << 8, 1 << 16] { | ||
| let ends = (0..=n) | ||
| .step_by(run_step) | ||
| .map(|x| x as u64) | ||
| .collect::<Buffer<_>>() | ||
| .into_array(); | ||
| let run_count = ends.len() - 1; | ||
| for valid_density in [0.01, 0.1, 0.5] { | ||
| let values = PrimitiveArray::from_option_iter( | ||
| (0..ends.len()).map(|x| rng.gen_bool(valid_density).then_some(x as u64)), | ||
| ) | ||
| .into_array(); | ||
| let array = RunEndArray::try_new(ends.clone(), values) | ||
| .unwrap() | ||
| .into_array(); | ||
|
|
||
| group.bench_function( | ||
| format!( | ||
| "null_count_run_end n: {}, run_count: {}, valid_density: {}", | ||
| n, run_count, valid_density | ||
| ), | ||
| |b| { | ||
| b.iter(|| { | ||
| black_box( | ||
| array | ||
| .encoding() | ||
| .compute_statistics(&array, Stat::NullCount) | ||
| .unwrap(), | ||
| ) | ||
| }); | ||
| }, | ||
| ); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| criterion_group!(benches, run_end_null_count); | ||
| criterion_main!(benches); |
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.
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.