Skip to content

Commit 0de463e

Browse files
ctskShiKaiWialamb
authored
Add benchmark for about view array slice (#7781)
(temporary branch for performance comparison) --------- Co-authored-by: ShiKaiWi <[email protected]> Co-authored-by: Andrew Lamb <[email protected]>
1 parent 01c5efc commit 0de463e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

arrow-array/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ name = "occupancy"
6464
harness = false
6565

6666
[[bench]]
67-
name = "gc_view_types"
67+
name = "view_types"
6868
harness = false
6969

7070
[[bench]]

arrow-array/benches/gc_view_types.rs renamed to arrow-array/benches/view_types.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
use arrow_array::StringViewArray;
1919
use criterion::*;
20-
use std::hint;
2120

2221
fn gen_view_array(size: usize) -> StringViewArray {
2322
StringViewArray::from_iter((0..size).map(|v| match v % 3 {
@@ -33,14 +32,20 @@ fn criterion_benchmark(c: &mut Criterion) {
3332

3433
c.bench_function("gc view types all", |b| {
3534
b.iter(|| {
36-
hint::black_box(array.gc());
35+
black_box(array.gc());
3736
});
3837
});
3938

4039
let sliced = array.slice(0, 100_000 / 2);
4140
c.bench_function("gc view types slice half", |b| {
4241
b.iter(|| {
43-
hint::black_box(sliced.gc());
42+
black_box(sliced.gc());
43+
});
44+
});
45+
46+
c.bench_function("view types slice", |b| {
47+
b.iter(|| {
48+
black_box(array.slice(0, 100_000 / 2));
4449
});
4550
});
4651
}

0 commit comments

Comments
 (0)