MCPcopy Create free account
hub / github.com/apache/datafusion / bench_array_sort

Function bench_array_sort

datafusion/functions-nested/benches/array_sort.rs:134–192  ·  view source on GitHub ↗

Vary elements_per_row over [5, 20, 100, 1000]: for small arrays, per-row overhead dominates, whereas for larger arrays the sort kernel dominates.

(c: &mut Criterion)

Source from the content-addressed store, hash-verified

132/// Vary elements_per_row over [5, 20, 100, 1000]: for small arrays, per-row
133/// overhead dominates, whereas for larger arrays the sort kernel dominates.
134fn bench_array_sort(c: &mut Criterion) {
135 let mut group = c.benchmark_group("array_sort");
136 let udf = ArraySort::new();
137
138 // Int32 arrays
139 for &elements_per_row in &[5, 20, 100, 1000] {
140 let array = create_int32_list_array(NUM_ROWS, elements_per_row, false);
141 group.bench_with_input(
142 BenchmarkId::new("int32", elements_per_row),
143 &elements_per_row,
144 |b, _| {
145 b.iter(|| {
146 black_box(invoke_array_sort(&udf, &array));
147 });
148 },
149 );
150 }
151
152 // Int32 with nulls in the outer list (10% null rows), single size
153 {
154 let array = create_int32_list_array(NUM_ROWS, 50, true);
155 group.bench_function("int32_with_nulls", |b| {
156 b.iter(|| {
157 black_box(invoke_array_sort(&udf, &array));
158 });
159 });
160 }
161
162 // Int32 with null elements (~10% of elements within rows are null)
163 for &elements_per_row in &[5, 20, 100, 1000] {
164 let array =
165 create_int32_list_array_with_null_elements(NUM_ROWS, elements_per_row);
166 group.bench_with_input(
167 BenchmarkId::new("int32_null_elements", elements_per_row),
168 &elements_per_row,
169 |b, _| {
170 b.iter(|| {
171 black_box(invoke_array_sort(&udf, &array));
172 });
173 },
174 );
175 }
176
177 // String arrays
178 for &elements_per_row in &[5, 20, 100, 1000] {
179 let array = create_string_list_array(NUM_ROWS, elements_per_row);
180 group.bench_with_input(
181 BenchmarkId::new("string", elements_per_row),
182 &elements_per_row,
183 |b, _| {
184 b.iter(|| {
185 black_box(invoke_array_sort(&udf, &array));
186 });
187 },
188 );
189 }
190
191 group.finish();

Callers

nothing calls this directly

Calls 7

newFunction · 0.85
create_int32_list_arrayFunction · 0.85
invoke_array_sortFunction · 0.85
create_string_list_arrayFunction · 0.70
iterMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…