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 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a "contains" fast-path to
like_utf8_scalar
(#1582)
- Loading branch information
1 parent
9a26422
commit 346c866
Showing
4 changed files
with
46 additions
and
1 deletion.
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,22 @@ | ||
use arrow2::util::bench_util::create_string_array; | ||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
|
||
use arrow2::array::*; | ||
use arrow2::compute::like::like_utf8_scalar; | ||
|
||
fn bench_like(array: &Utf8Array<i32>, pattern: &str) { | ||
criterion::black_box(like_utf8_scalar(array, pattern).unwrap()); | ||
} | ||
|
||
fn add_benchmark(c: &mut Criterion) { | ||
for size_log2 in 16..21_u32 { | ||
let size = size_log2.pow(2) as usize; | ||
let array = create_string_array::<i32>(100, size, 0.0, 0); | ||
c.bench_function(&format!("LIKE length = 2^{}", size_log2), |b| { | ||
b.iter(|| bench_like(&array, "%abba%")) | ||
}); | ||
} | ||
} | ||
|
||
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
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