Skip to content

Commit

Permalink
chore: Benchmark deps cleanup (#14793)
Browse files Browse the repository at this point in the history
* 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).
  • Loading branch information
findepi authored Feb 21, 2025
1 parent c92df4f commit 2325b6c
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ async-trait = "0.1.73"
bigdecimal = "0.4.7"
bytes = "1.10"
chrono = { version = "0.4.38", default-features = false }
criterion = "0.5.1"
ctor = "0.2.9"
dashmap = "6.0.1"
datafusion = { path = "datafusion/core", version = "45.0.0", default-features = false }
Expand Down Expand Up @@ -144,7 +145,7 @@ pbjson-types = "0.7"
# Should match arrow-flight's version of prost.
prost = "0.13.1"
prost-derive = "0.13.1"
rand = "0.8"
rand = "0.8.5"
recursive = "0.1.1"
regex = "1.8"
rstest = "0.24.0"
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ zstd = { version = "0.13", optional = true, default-features = false }

[dev-dependencies]
async-trait = { workspace = true }
criterion = { version = "0.5", features = ["async_tokio"] }
criterion = { workspace = true, features = ["async_tokio"] }
ctor = { workspace = true }
dashmap = "6.1.0"
datafusion-doc = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions-aggregate-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ datafusion-expr-common = { workspace = true }
datafusion-physical-expr-common = { workspace = true }

[dev-dependencies]
criterion = "0.5"
criterion = { workspace = true }
rand = { workspace = true }

[[bench]]
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions-aggregate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ paste = "1.0.14"

[dev-dependencies]
arrow = { workspace = true, features = ["test_utils"] }
criterion = "0.5"
criterion = { workspace = true }
rand = { workspace = true }

[[bench]]
Expand Down
4 changes: 2 additions & 2 deletions datafusion/functions-nested/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ log = { workspace = true }
paste = "1.0.14"

[dev-dependencies]
criterion = { version = "0.5", features = ["async_tokio"] }
rand = "0.8.5"
criterion = { workspace = true, features = ["async_tokio"] }
rand = { workspace = true }

[[bench]]
harness = false
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ uuid = { version = "1.13", features = ["v4"], optional = true }

[dev-dependencies]
arrow = { workspace = true, features = ["test_utils"] }
criterion = "0.5"
criterion = { workspace = true }
rand = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt", "sync"] }

Expand Down
5 changes: 2 additions & 3 deletions datafusion/functions/benches/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn gen_string_array(
let rng_ref = &mut rng;

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

let mut output_string_vec: Vec<Option<String>> = Vec::with_capacity(n_rows);
for _ in 0..n_rows {
Expand All @@ -46,8 +46,7 @@ pub fn gen_string_array(
// Generate random UTF8 string
let mut generated_string = String::with_capacity(str_len_chars);
for _ in 0..str_len_chars {
let idx = rng_ref.gen_range(0..corpus_char_count);
let char = corpus.chars().nth(idx).unwrap();
let char = corpus[rng_ref.gen_range(0..corpus.len())];
generated_string.push(char);
}
output_string_vec.push(Some(generated_string));
Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-expr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ petgraph = "0.7.1"

[dev-dependencies]
arrow = { workspace = true, features = ["test_utils"] }
criterion = "0.5"
criterion = { workspace = true }
datafusion-functions = { workspace = true }
rand = { workspace = true }
rstest = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-plan/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pin-project-lite = "^0.2.7"
tokio = { workspace = true }

[dev-dependencies]
criterion = { version = "0.5", features = ["async_futures"] }
criterion = { workspace = true, features = ["async_futures"] }
datafusion-functions-aggregate = { workspace = true }
datafusion-functions-window = { workspace = true }
rand = { workspace = true }
Expand Down

0 comments on commit 2325b6c

Please sign in to comment.