Skip to content

Commit 2325b6c

Browse files
authored
chore: Benchmark deps cleanup (apache#14793)
* Synchronize criterion version across workspace Use same version everywhere. This means update for some crates. * Synchronize and update rand version across workspace Use same version everywhere and update. * Avoid linear search for character in bench helper Get the char in O(1) instead of O(n).
1 parent c92df4f commit 2325b6c

File tree

9 files changed

+12
-12
lines changed

9 files changed

+12
-12
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ async-trait = "0.1.73"
9595
bigdecimal = "0.4.7"
9696
bytes = "1.10"
9797
chrono = { version = "0.4.38", default-features = false }
98+
criterion = "0.5.1"
9899
ctor = "0.2.9"
99100
dashmap = "6.0.1"
100101
datafusion = { path = "datafusion/core", version = "45.0.0", default-features = false }
@@ -144,7 +145,7 @@ pbjson-types = "0.7"
144145
# Should match arrow-flight's version of prost.
145146
prost = "0.13.1"
146147
prost-derive = "0.13.1"
147-
rand = "0.8"
148+
rand = "0.8.5"
148149
recursive = "0.1.1"
149150
regex = "1.8"
150151
rstest = "0.24.0"

datafusion/core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ zstd = { version = "0.13", optional = true, default-features = false }
131131

132132
[dev-dependencies]
133133
async-trait = { workspace = true }
134-
criterion = { version = "0.5", features = ["async_tokio"] }
134+
criterion = { workspace = true, features = ["async_tokio"] }
135135
ctor = { workspace = true }
136136
dashmap = "6.1.0"
137137
datafusion-doc = { workspace = true }

datafusion/functions-aggregate-common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ datafusion-expr-common = { workspace = true }
4444
datafusion-physical-expr-common = { workspace = true }
4545

4646
[dev-dependencies]
47-
criterion = "0.5"
47+
criterion = { workspace = true }
4848
rand = { workspace = true }
4949

5050
[[bench]]

datafusion/functions-aggregate/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ paste = "1.0.14"
5454

5555
[dev-dependencies]
5656
arrow = { workspace = true, features = ["test_utils"] }
57-
criterion = "0.5"
57+
criterion = { workspace = true }
5858
rand = { workspace = true }
5959

6060
[[bench]]

datafusion/functions-nested/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ log = { workspace = true }
5353
paste = "1.0.14"
5454

5555
[dev-dependencies]
56-
criterion = { version = "0.5", features = ["async_tokio"] }
57-
rand = "0.8.5"
56+
criterion = { workspace = true, features = ["async_tokio"] }
57+
rand = { workspace = true }
5858

5959
[[bench]]
6060
harness = false

datafusion/functions/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ uuid = { version = "1.13", features = ["v4"], optional = true }
8989

9090
[dev-dependencies]
9191
arrow = { workspace = true, features = ["test_utils"] }
92-
criterion = "0.5"
92+
criterion = { workspace = true }
9393
rand = { workspace = true }
9494
tokio = { workspace = true, features = ["macros", "rt", "sync"] }
9595

datafusion/functions/benches/helper.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn gen_string_array(
3535
let rng_ref = &mut rng;
3636

3737
let corpus = "DataFusionДатаФусион数据融合📊🔥"; // includes utf8 encoding with 1~4 bytes
38-
let corpus_char_count = corpus.chars().count();
38+
let corpus = corpus.chars().collect::<Vec<_>>();
3939

4040
let mut output_string_vec: Vec<Option<String>> = Vec::with_capacity(n_rows);
4141
for _ in 0..n_rows {
@@ -46,8 +46,7 @@ pub fn gen_string_array(
4646
// Generate random UTF8 string
4747
let mut generated_string = String::with_capacity(str_len_chars);
4848
for _ in 0..str_len_chars {
49-
let idx = rng_ref.gen_range(0..corpus_char_count);
50-
let char = corpus.chars().nth(idx).unwrap();
49+
let char = corpus[rng_ref.gen_range(0..corpus.len())];
5150
generated_string.push(char);
5251
}
5352
output_string_vec.push(Some(generated_string));

datafusion/physical-expr/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ petgraph = "0.7.1"
5555

5656
[dev-dependencies]
5757
arrow = { workspace = true, features = ["test_utils"] }
58-
criterion = "0.5"
58+
criterion = { workspace = true }
5959
datafusion-functions = { workspace = true }
6060
rand = { workspace = true }
6161
rstest = { workspace = true }

datafusion/physical-plan/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pin-project-lite = "^0.2.7"
6565
tokio = { workspace = true }
6666

6767
[dev-dependencies]
68-
criterion = { version = "0.5", features = ["async_futures"] }
68+
criterion = { workspace = true, features = ["async_futures"] }
6969
datafusion-functions-aggregate = { workspace = true }
7070
datafusion-functions-window = { workspace = true }
7171
rand = { workspace = true }

0 commit comments

Comments
 (0)