Skip to content

Commit 9f0df74

Browse files
authored
Update criterion to 0.7.* (#18472)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> - Closes #18418 ## Rationale for this change Keep dependencies up to date. ## What changes are included in this PR? Benchmark updates. ## Are these changes tested? Yes, every single benchmark was run. ## Are there any user-facing changes? No.
1 parent 8833253 commit 9f0df74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+133
-131
lines changed

Cargo.lock

Lines changed: 6 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ async-trait = "0.1.89"
108108
bigdecimal = "0.4.8"
109109
bytes = "1.10"
110110
chrono = { version = "0.4.42", default-features = false }
111-
criterion = "0.5.1"
111+
criterion = "0.7"
112112
ctor = "0.6.1"
113113
dashmap = "6.0.1"
114114
datafusion = { path = "datafusion/core", version = "50.3.0", default-features = false }

datafusion/core/benches/aggregate_query_sql.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,19 @@ extern crate arrow;
2121
extern crate datafusion;
2222

2323
mod data_utils;
24+
2425
use crate::criterion::Criterion;
2526
use data_utils::create_table_provider;
2627
use datafusion::error::Result;
2728
use datafusion::execution::context::SessionContext;
2829
use parking_lot::Mutex;
30+
use std::hint::black_box;
2931
use std::sync::Arc;
3032
use tokio::runtime::Runtime;
3133

3234
fn query(ctx: Arc<Mutex<SessionContext>>, rt: &Runtime, sql: &str) {
3335
let df = rt.block_on(ctx.lock().sql(sql)).unwrap();
34-
criterion::black_box(rt.block_on(df.collect()).unwrap());
36+
black_box(rt.block_on(df.collect()).unwrap());
3537
}
3638

3739
fn create_context(

datafusion/core/benches/csv_load.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ extern crate arrow;
2121
extern crate datafusion;
2222

2323
mod data_utils;
24+
2425
use crate::criterion::Criterion;
2526
use datafusion::error::Result;
2627
use datafusion::execution::context::SessionContext;
2728
use datafusion::prelude::CsvReadOptions;
2829
use datafusion::test_util::csv::TestCsvFile;
2930
use parking_lot::Mutex;
31+
use std::hint::black_box;
3032
use std::sync::Arc;
3133
use std::time::Duration;
3234
use test_utils::AccessLogGenerator;
@@ -39,7 +41,7 @@ fn load_csv(
3941
options: CsvReadOptions,
4042
) {
4143
let df = rt.block_on(ctx.lock().read_csv(path, options)).unwrap();
42-
criterion::black_box(rt.block_on(df.collect()).unwrap());
44+
black_box(rt.block_on(df.collect()).unwrap());
4345
}
4446

4547
fn create_context() -> Result<Arc<Mutex<SessionContext>>> {

datafusion/core/benches/dataframe.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use datafusion::datasource::MemTable;
2626
use datafusion::prelude::SessionContext;
2727
use datafusion_expr::col;
2828
use datafusion_functions::expr_fn::btrim;
29+
use std::hint::black_box;
2930
use std::sync::Arc;
3031
use tokio::runtime::Runtime;
3132

@@ -45,7 +46,7 @@ fn create_context(field_count: u32) -> datafusion_common::Result<Arc<SessionCont
4546
}
4647

4748
fn run(column_count: u32, ctx: Arc<SessionContext>, rt: &Runtime) {
48-
criterion::black_box(rt.block_on(async {
49+
black_box(rt.block_on(async {
4950
let mut data_frame = ctx.table("t").await.unwrap();
5051

5152
for i in 0..column_count {

datafusion/core/benches/distinct_query_sql.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ use datafusion_execution::config::SessionConfig;
3030
use datafusion_execution::TaskContext;
3131

3232
use parking_lot::Mutex;
33+
use std::hint::black_box;
3334
use std::{sync::Arc, time::Duration};
3435
use tokio::runtime::Runtime;
3536

3637
fn query(ctx: Arc<Mutex<SessionContext>>, rt: &Runtime, sql: &str) {
3738
let df = rt.block_on(ctx.lock().sql(sql)).unwrap();
38-
criterion::black_box(rt.block_on(df.collect()).unwrap());
39+
black_box(rt.block_on(df.collect()).unwrap());
3940
}
4041

4142
fn create_context(
@@ -124,8 +125,7 @@ async fn distinct_with_limit(
124125
}
125126

126127
fn run(rt: &Runtime, plan: Arc<dyn ExecutionPlan>, ctx: Arc<TaskContext>) {
127-
criterion::black_box(rt.block_on(distinct_with_limit(plan.clone(), ctx.clone())))
128-
.unwrap();
128+
black_box(rt.block_on(distinct_with_limit(plan.clone(), ctx.clone()))).unwrap();
129129
}
130130

131131
pub async fn create_context_sampled_data(

datafusion/core/benches/filter_query_sql.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ use criterion::{criterion_group, criterion_main, Criterion};
2424
use datafusion::prelude::SessionContext;
2525
use datafusion::{datasource::MemTable, error::Result};
2626
use futures::executor::block_on;
27+
use std::hint::black_box;
2728
use std::sync::Arc;
2829
use tokio::runtime::Runtime;
2930

3031
async fn query(ctx: &SessionContext, rt: &Runtime, sql: &str) {
3132
// execute the query
3233
let df = rt.block_on(ctx.sql(sql)).unwrap();
33-
criterion::black_box(rt.block_on(df.collect()).unwrap());
34+
black_box(rt.block_on(df.collect()).unwrap());
3435
}
3536

3637
fn create_context(array_len: usize, batch_size: usize) -> Result<SessionContext> {

datafusion/core/benches/map_query_sql.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
use std::hint::black_box;
1819
use std::sync::Arc;
1920

2021
use arrow::array::{ArrayRef, Int32Array, RecordBatch};
21-
use criterion::{black_box, criterion_group, criterion_main, Criterion};
22+
use criterion::{criterion_group, criterion_main, Criterion};
2223
use parking_lot::Mutex;
2324
use rand::prelude::ThreadRng;
2425
use rand::Rng;

datafusion/core/benches/spm.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
use std::hint::black_box;
1819
use std::sync::Arc;
1920

2021
use arrow::array::{ArrayRef, Int32Array, Int64Array, RecordBatch, StringArray};
@@ -25,7 +26,7 @@ use datafusion_physical_plan::sorts::sort_preserving_merge::SortPreservingMergeE
2526
use datafusion_physical_plan::{collect, ExecutionPlan};
2627

2728
use criterion::async_executor::FuturesExecutor;
28-
use criterion::{black_box, criterion_group, criterion_main, Criterion};
29+
use criterion::{criterion_group, criterion_main, Criterion};
2930
use datafusion_datasource::memory::MemorySourceConfig;
3031

3132
fn generate_spm_for_round_robin_tie_breaker(

datafusion/core/benches/sql_planner.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use datafusion::datasource::MemTable;
3030
use datafusion::execution::context::SessionContext;
3131
use datafusion_common::{config::Dialect, ScalarValue};
3232
use datafusion_expr::col;
33+
use std::hint::black_box;
3334
use std::path::PathBuf;
3435
use std::sync::Arc;
3536
use test_utils::tpcds::tpcds_schemas;
@@ -43,12 +44,12 @@ const CLICKBENCH_DATA_PATH: &str = "data/hits_partitioned/";
4344

4445
/// Create a logical plan from the specified sql
4546
fn logical_plan(ctx: &SessionContext, rt: &Runtime, sql: &str) {
46-
criterion::black_box(rt.block_on(ctx.sql(sql)).unwrap());
47+
black_box(rt.block_on(ctx.sql(sql)).unwrap());
4748
}
4849

4950
/// Create a physical ExecutionPlan (by way of logical plan)
5051
fn physical_plan(ctx: &SessionContext, rt: &Runtime, sql: &str) {
51-
criterion::black_box(rt.block_on(async {
52+
black_box(rt.block_on(async {
5253
ctx.sql(sql)
5354
.await
5455
.unwrap()
@@ -145,7 +146,7 @@ fn benchmark_with_param_values_many_columns(
145146
rt.block_on(async { ctx.state().statement_to_plan(statement).await.unwrap() });
146147
b.iter(|| {
147148
let plan = plan.clone();
148-
criterion::black_box(plan.with_param_values(vec![ScalarValue::from(1)]).unwrap());
149+
black_box(plan.with_param_values(vec![ScalarValue::from(1)]).unwrap());
149150
});
150151
}
151152

0 commit comments

Comments
 (0)