Apache DataFusion SQL Query Engine
Allow benchmark allocator features together (#21905)
xudong.wcae03c902881
diff --git a/benchmarks/benches/sql.rs b/benchmarks/benches/sql.rsindex eade3194d1..73302b4763 100644--- a/benchmarks/benches/sql.rs+++ b/benchmarks/benches/sql.rs@@ -43,16 +43,13 @@ static SQL_BENCHMARK_DIRECTORY: LazyLock<String> = LazyLock::new(|| {)});-#[cfg(all(feature = "snmalloc", feature = "mimalloc"))]-compile_error!(- "feature \"snmalloc\" and feature \"mimalloc\" cannot be enabled at the same time"-);-#[cfg(feature = "snmalloc")]#[global_allocator]static ALLOC: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;-#[cfg(feature = "mimalloc")]+// `cargo clippy --all-features` enables both allocator features, so prefer+// `snmalloc` in that case and fall back to `mimalloc` otherwise.+#[cfg(all(not(feature = "snmalloc"), feature = "mimalloc"))]#[global_allocator]static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;diff --git a/benchmarks/src/bin/benchmark_runner.rs b/benchmarks/src/bin/benchmark_runner.rsindex 831d6f96d7..0efd169947 100644--- a/benchmarks/src/bin/benchmark_runner.rs+++ b/benchmarks/src/bin/benchmark_runner.rs@@ -17,16 +17,13 @@use datafusion_benchmarks::benchmark_runner::run_cli;-#[cfg(all(feature = "snmalloc", feature = "mimalloc"))]-compile_error!(- "feature \"snmalloc\" and feature \"mimalloc\" cannot be enabled at the same time"-);-#[cfg(feature = "snmalloc")]#[global_allocator]static ALLOC: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;-#[cfg(feature = "mimalloc")]+// `cargo clippy --all-features` enables both allocator features, so prefer+// `snmalloc` in that case and fall back to `mimalloc` otherwise.+#[cfg(all(not(feature = "snmalloc"), feature = "mimalloc"))]#[global_allocator]static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;diff --git a/benchmarks/src/bin/dfbench.rs b/benchmarks/src/bin/dfbench.rsindex 3b1f54291e..cef73ad683 100644--- a/benchmarks/src/bin/dfbench.rs+++ b/benchmarks/src/bin/dfbench.rs@@ -20,16 +20,13 @@ use datafusion::error::Result;use clap::{Parser, Subcommand};-#[cfg(all(feature = "snmalloc", feature = "mimalloc"))]-compile_error!(- "feature \"snmalloc\" and feature \"mimalloc\" cannot be enabled at the same time"-);-#[cfg(feature = "snmalloc")]#[global_allocator]static ALLOC: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;-#[cfg(feature = "mimalloc")]+// `cargo clippy --all-features` enables both allocator features, so prefer+// `snmalloc` in that case and fall back to `mimalloc` otherwise.+#[cfg(all(not(feature = "snmalloc"), feature = "mimalloc"))]#[global_allocator]static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;diff --git a/benchmarks/src/bin/imdb.rs b/benchmarks/src/bin/imdb.rsindex e86735f87b..ab1c9c1302 100644--- a/benchmarks/src/bin/imdb.rs+++ b/benchmarks/src/bin/imdb.rs@@ -21,16 +21,13 @@ use clap::{Parser, Subcommand};use datafusion::error::Result;use datafusion_benchmarks::imdb;-#[cfg(all(feature = "snmalloc", feature = "mimalloc"))]-compile_error!(- "feature \"snmalloc\" and feature \"mimalloc\" cannot be enabled at the same time"-);-#[cfg(feature = "snmalloc")]#[global_allocator]static ALLOC: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;-#[cfg(feature = "mimalloc")]+// `cargo clippy --all-features` enables both allocator features, so prefer+// `snmalloc` in that case and fall back to `mimalloc` otherwise.+#[cfg(all(not(feature = "snmalloc"), feature = "mimalloc"))]#[global_allocator]static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;