This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0742edd
commit afb05d2
Showing
4 changed files
with
127 additions
and
0 deletions.
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,60 @@ | ||
extern crate arrow2; | ||
|
||
use std::iter::FromIterator; | ||
|
||
use arrow2::bitmap::*; | ||
|
||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
|
||
// | ||
|
||
fn add_benchmark(c: &mut Criterion) { | ||
(10..=20).step_by(2).for_each(|log2_size| { | ||
let size = 2usize.pow(log2_size); | ||
|
||
let bitmap2 = Bitmap::from_iter((0..size).into_iter().map(|x| x % 3 == 0)); | ||
|
||
c.bench_function(&format!("bitmap extend aligned 2^{}", log2_size), |b| { | ||
let mut bitmap1 = MutableBitmap::new(); | ||
b.iter(|| { | ||
bitmap1.extend_from_bitmap(&bitmap2); | ||
bitmap1.clear(); | ||
}) | ||
}); | ||
|
||
c.bench_function(&format!("bitmap extend unaligned 2^{}", log2_size), |b| { | ||
let mut bitmap1 = MutableBitmap::with_capacity(1); | ||
b.iter(|| { | ||
bitmap1.push(true); | ||
bitmap1.extend_from_bitmap(&bitmap2); | ||
bitmap1.clear(); | ||
}) | ||
}); | ||
|
||
c.bench_function( | ||
&format!("bitmap extend_constant aligned 2^{}", log2_size), | ||
|b| { | ||
let mut bitmap1 = MutableBitmap::new(); | ||
b.iter(|| { | ||
bitmap1.extend_constant(size, true); | ||
bitmap1.clear(); | ||
}) | ||
}, | ||
); | ||
|
||
c.bench_function( | ||
&format!("bitmap extend_constant unaligned 2^{}", log2_size), | ||
|b| { | ||
let mut bitmap1 = MutableBitmap::with_capacity(1); | ||
b.iter(|| { | ||
bitmap1.push(true); | ||
bitmap1.extend_constant(size, true); | ||
bitmap1.clear(); | ||
}) | ||
}, | ||
); | ||
}); | ||
} | ||
|
||
criterion_group!(benches, add_benchmark); | ||
criterion_main!(benches); |
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,52 @@ | ||
extern crate arrow2; | ||
|
||
use arrow2::{ | ||
compute::concat, | ||
datatypes::DataType, | ||
util::bench_util::{create_boolean_array, create_primitive_array}, | ||
}; | ||
|
||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
|
||
fn add_benchmark(c: &mut Criterion) { | ||
(20..=20).step_by(2).for_each(|log2_size| { | ||
let size = 2usize.pow(log2_size); | ||
|
||
let array1 = create_primitive_array::<i32>(8, DataType::Int32, 0.5); | ||
let array2 = create_primitive_array::<i32>(size + 1, DataType::Int32, 0.5); | ||
|
||
c.bench_function(&format!("int32 concat aligned 2^{}", log2_size), |b| { | ||
b.iter(|| { | ||
let _ = concat::concatenate(&[&array1, &array2]); | ||
}) | ||
}); | ||
|
||
let array1 = create_primitive_array::<i32>(9, DataType::Int32, 0.5); | ||
|
||
c.bench_function(&format!("int32 concat unaligned 2^{}", log2_size), |b| { | ||
b.iter(|| { | ||
let _ = concat::concatenate(&[&array1, &array2]); | ||
}) | ||
}); | ||
|
||
let array1 = create_boolean_array(8, 0.5, 0.5); | ||
let array2 = create_boolean_array(size + 1, 0.5, 0.5); | ||
|
||
c.bench_function(&format!("boolean concat aligned 2^{}", log2_size), |b| { | ||
b.iter(|| { | ||
let _ = concat::concatenate(&[&array1, &array2]); | ||
}) | ||
}); | ||
|
||
let array1 = create_boolean_array(9, 0.5, 0.5); | ||
|
||
c.bench_function(&format!("boolean concat unaligned 2^{}", log2_size), |b| { | ||
b.iter(|| { | ||
let _ = concat::concatenate(&[&array1, &array2]); | ||
}) | ||
}); | ||
}); | ||
} | ||
|
||
criterion_group!(benches, add_benchmark); | ||
criterion_main!(benches); |
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