Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
add validity to list_iter bench
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Sep 23, 2021
1 parent 12072a1 commit 16ff535
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion benches/iter_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use arrow2::{
datatypes::DataType,
};

use arrow2::bitmap::Bitmap;
use arrow2::buffer::MutableBuffer;
use criterion::{criterion_group, criterion_main, Criterion};
use std::iter::FromIterator;
Expand All @@ -19,8 +20,17 @@ fn add_benchmark(c: &mut Criterion) {
let mut offsets = MutableBuffer::from_iter((0..size as i32).step_by(2));
offsets.push(size as i32);

let validity = (0..(offsets.len() - 1))
.map(|i| i % 4 == 0)
.collect::<Bitmap>();

let data_type = ListArray::<i32>::default_datatype(DataType::Int32);
let array = ListArray::<i32>::from_data(data_type, offsets.into(), Arc::new(values), None);
let array = ListArray::<i32>::from_data(
data_type,
offsets.into(),
Arc::new(values),
Some(validity),
);

c.bench_function(&format!("list: iter_values 2^{}", log2_size), |b| {
b.iter(|| {
Expand Down

0 comments on commit 16ff535

Please sign in to comment.