martin-g commented on code in PR #19888:
URL: https://github.com/apache/datafusion/pull/19888#discussion_r2707939683
##########
datafusion/functions/benches/cot.rs:
##########
@@ -85,6 +86,51 @@ fn criterion_benchmark(c: &mut Criterion) {
)
})
});
+
+ // Scalar benchmarks
+ let scalar_f32_args =
+ vec![ColumnarValue::Scalar(ScalarValue::Float32(Some(1.0)))];
+ let scalar_f32_arg_fields =
+ vec![Field::new("a", DataType::Float32, false).into()];
+ let return_field_f32 = Field::new("f", DataType::Float32,
false).into();
+
+ c.bench_function(&format!("cot f32 scalar: {size}"), |b| {
+ b.iter(|| {
+ black_box(
+ cot_fn
+ .invoke_with_args(ScalarFunctionArgs {
+ args: scalar_f32_args.clone(),
+ arg_fields: scalar_f32_arg_fields.clone(),
+ number_rows: 1,
Review Comment:
```suggestion
number_rows: size,
```
Currently the input is always the same for all values of `size`. Maybe the
`number_rows` could be used to make it a bit different ?!
##########
datafusion/functions/benches/cot.rs:
##########
@@ -85,6 +86,51 @@ fn criterion_benchmark(c: &mut Criterion) {
)
})
});
+
+ // Scalar benchmarks
+ let scalar_f32_args =
+ vec![ColumnarValue::Scalar(ScalarValue::Float32(Some(1.0)))];
+ let scalar_f32_arg_fields =
+ vec![Field::new("a", DataType::Float32, false).into()];
+ let return_field_f32 = Field::new("f", DataType::Float32,
false).into();
+
+ c.bench_function(&format!("cot f32 scalar: {size}"), |b| {
+ b.iter(|| {
+ black_box(
+ cot_fn
+ .invoke_with_args(ScalarFunctionArgs {
+ args: scalar_f32_args.clone(),
+ arg_fields: scalar_f32_arg_fields.clone(),
+ number_rows: 1,
+ return_field: Arc::clone(&return_field_f32),
+ config_options: Arc::clone(&config_options),
+ })
+ .unwrap(),
+ )
+ })
+ });
+
+ let scalar_f64_args =
+ vec![ColumnarValue::Scalar(ScalarValue::Float64(Some(1.0)))];
+ let scalar_f64_arg_fields =
+ vec![Field::new("a", DataType::Float64, false).into()];
+ let return_field_f64 = Field::new("f", DataType::Float64,
false).into();
+
+ c.bench_function(&format!("cot f64 scalar: {size}"), |b| {
+ b.iter(|| {
+ black_box(
+ cot_fn
+ .invoke_with_args(ScalarFunctionArgs {
+ args: scalar_f64_args.clone(),
+ arg_fields: scalar_f64_arg_fields.clone(),
+ number_rows: 1,
Review Comment:
```suggestion
number_rows: size,
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]