This is an automated email from the ASF dual-hosted git repository.
Jefffrey pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/main by this push:
new 1c1c60cd37 bench: add string_view rank benchmarks (#10600)
1c1c60cd37 is described below
commit 1c1c60cd37d3726e2880b51cca56c22de74772fc
Author: Thefool <[email protected]>
AuthorDate: Mon Aug 10 15:57:13 2026 +0800
bench: add string_view rank benchmarks (#10600)
# Which issue does this PR close?
None.
# Rationale for this change
arrow_ord::rank gained a Utf8View/BinaryView path (byte_view_rank) in
#10559, but the rank benchmarks in arrow/benches/sort_kernel.rs were not
updated—they only cover the primitive_rank (f32) and bytes_rank
(string[10]) paths, so the new view path has no benchmark coverage. The
sort/sort_to_indices benchmarks in the same file already cover
string_view, so this brings rank in line with them.
byte_view_rank reads values from the view layout rather than the
contiguous buffer used by bytes_rank, and the fixed- vs variable-length
shapes decide how often a value spills out of the inline prefix into a
separate buffer—both worth measuring on their own.
# What changes are included in this PR?
Adds rank string_view[10] and rank string_view[0-400] benchmarks (each
with and without nulls), mirroring the existing sort string_view cases.
Reuses the create_string_view_array* helpers from bench_util—no new
helpers.
# Are there any user-facing changes?
No.
# Which issue does this PR close?
- Closes https://github.com/apache/arrow-rs/issues/10599
---
arrow/benches/sort_kernel.rs | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/arrow/benches/sort_kernel.rs b/arrow/benches/sort_kernel.rs
index b8cbb1581d..7e5584f090 100644
--- a/arrow/benches/sort_kernel.rs
+++ b/arrow/benches/sort_kernel.rs
@@ -318,6 +318,26 @@ fn add_benchmark(c: &mut Criterion) {
c.bench_function("rank string[10] nulls 2^12", |b| {
b.iter(|| hint::black_box(rank(&arr, None).unwrap()))
});
+
+ let arr = create_string_view_array_with_fixed_len(2usize.pow(12), 0.0, 10);
+ c.bench_function("rank string_view[10] 2^12", |b| {
+ b.iter(|| hint::black_box(rank(&arr, None).unwrap()))
+ });
+
+ let arr = create_string_view_array_with_fixed_len(2usize.pow(12), 0.5, 10);
+ c.bench_function("rank string_view[10] nulls 2^12", |b| {
+ b.iter(|| hint::black_box(rank(&arr, None).unwrap()))
+ });
+
+ let arr = create_string_view_array(2usize.pow(12), 0.0);
+ c.bench_function("rank string_view[0-400] 2^12", |b| {
+ b.iter(|| hint::black_box(rank(&arr, None).unwrap()))
+ });
+
+ let arr = create_string_view_array(2usize.pow(12), 0.5);
+ c.bench_function("rank string_view[0-400] nulls 2^12", |b| {
+ b.iter(|| hint::black_box(rank(&arr, None).unwrap()))
+ });
}
criterion_group!(benches, add_benchmark);