Skip to content

Commit 608f2d9

Browse files
authored
Cleanup mimalloc usage in benchmarks (#3133)
1. Only configure in one place (lib.rs) so all future benchmarks will also pull it automatically. 2. Allow opting out of it in `vortex-ffi` 3. Remove meaningless `mimalloc` feature that got leftover
1 parent eeb0a62 commit 608f2d9

File tree

9 files changed

+8
-18
lines changed

9 files changed

+8
-18
lines changed

bench-vortex/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,4 @@ vortex-io = { workspace = true, features = ["tokio"] }
7070
xshell = { workspace = true }
7171

7272
[features]
73-
mimalloc = []
7473
tracing = ["vortex-datafusion/tracing"]

bench-vortex/src/bin/clickbench.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ use url::Url;
2828
use vortex::error::{VortexExpect, vortex_panic};
2929
use vortex_datafusion::persistent::metrics::VortexMetricsFinder;
3030

31-
#[global_allocator]
32-
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
33-
3431
#[derive(Parser, Debug)]
3532
#[command(version, about, long_about = None)]
3633
struct Args {

bench-vortex/src/bin/compress.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ use vortex::builders::builder_with_capacity;
1818
use vortex::error::VortexUnwrap;
1919
use vortex::{Array, ArrayExt};
2020

21-
#[global_allocator]
22-
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
23-
2421
#[derive(Parser, Debug)]
2522
#[command(version, about, long_about = None)]
2623
struct Args {

bench-vortex/src/bin/public_bi.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ use tracing_futures::Instrument;
1515
use vortex::error::{VortexExpect, vortex_panic};
1616
use vortex_datafusion::persistent::metrics::VortexMetricsFinder;
1717

18-
#[global_allocator]
19-
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
20-
2118
#[derive(Parser, Debug)]
2219
#[command(version, about, long_about = None)]
2320
struct Args {

bench-vortex/src/bin/random_access.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ use tokio::runtime::Runtime;
1313
use vortex::buffer::{Buffer, buffer};
1414
use vortex::error::VortexUnwrap;
1515

16-
#[global_allocator]
17-
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
18-
1916
#[derive(Parser, Debug)]
2017
#[command(version, about, long_about = None)]
2118
struct Args {

bench-vortex/src/bin/tpch.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ use vortex::aliases::hash_map::HashMap;
3232
use vortex::error::VortexExpect;
3333
use vortex_datafusion::persistent::metrics::VortexMetricsFinder;
3434

35-
#[global_allocator]
36-
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
37-
3835
#[derive(Parser, Debug)]
3936
#[command(version, about, long_about = None)]
4037
struct Args {

bench-vortex/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ pub use datasets::{BenchmarkDataset, file};
2929
pub use engines::{ddb, df};
3030
pub use vortex::error::vortex_panic;
3131

32+
// All benchmarks run with mimalloc for consistency.
33+
#[global_allocator]
34+
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
35+
3236
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Serialize)]
3337
pub struct Target {
3438
engine: Engine,

vortex-ffi/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ duckdb = { workspace = true, optional = true }
2121
futures = { workspace = true }
2222
itertools = { workspace = true }
2323
log = { workspace = true }
24-
mimalloc = { workspace = true }
24+
mimalloc = { workspace = true, optional = true }
2525
object_store = { workspace = true, features = ["aws", "azure", "gcp"] }
2626
paste = { workspace = true }
2727
prost = { workspace = true }
@@ -32,6 +32,8 @@ vortex = { workspace = true, features = ["object_store", "proto"] }
3232
vortex-duckdb = { workspace = true, optional = true }
3333

3434
[features]
35+
default = ["mimalloc"]
36+
mimalloc = ["dep:mimalloc"]
3537
duckdb = ["dep:vortex-duckdb", "dep:duckdb"]
3638

3739
[lib]

vortex-ffi/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub use log::vx_log_level;
1818
use tokio::runtime::{Builder, Runtime};
1919
use vortex::error::VortexExpect;
2020

21-
#[cfg(not(miri))]
21+
#[cfg(all(feature = "mimalloc", not(miri)))]
2222
#[global_allocator]
2323
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
2424

0 commit comments

Comments
 (0)