From 91f85b6e43078e2caa46f2411ca4ed7db69eb4e6 Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Mon, 23 Oct 2023 11:08:14 +0100 Subject: [PATCH 1/3] perf: Use jemallocator by default for taso --- Cargo.toml | 3 +++ taso-optimiser/Cargo.toml | 5 ++++- taso-optimiser/src/main.rs | 7 ++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 91a7f94c..9a646b43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,9 @@ bench = false name = "tket2" path = "src/lib.rs" +[profile.release] +lto = "thin" + [dependencies] lazy_static = "1.4.0" cgmath = "0.18.0" diff --git a/taso-optimiser/Cargo.toml b/taso-optimiser/Cargo.toml index d3106737..5d82ccb7 100644 --- a/taso-optimiser/Cargo.toml +++ b/taso-optimiser/Cargo.toml @@ -17,6 +17,9 @@ tracing-subscriber = "0.3.17" tracing-appender = "0.2.2" peak_alloc = { version = "0.2.0", optional = true } +[target.'cfg(not(target_env = "msvc"))'.dependencies] +tikv-jemallocator = "0.5" + [features] -default = ["peak_alloc"] +default = [] peak_alloc = ["dep:peak_alloc"] diff --git a/taso-optimiser/src/main.rs b/taso-optimiser/src/main.rs index 9ca1242a..be58c97a 100644 --- a/taso-optimiser/src/main.rs +++ b/taso-optimiser/src/main.rs @@ -15,11 +15,12 @@ use tket2::optimiser::taso::log::TasoLogger; use tket2::optimiser::TasoOptimiser; #[cfg(feature = "peak_alloc")] -use peak_alloc::PeakAlloc; +#[global_allocator] +static PEAK_ALLOC: peak_alloc::PeakAlloc = peak_alloc::PeakAlloc; -#[cfg(feature = "peak_alloc")] +#[cfg(all(not(target_env = "msvc"), not(feature = "peak_alloc")))] #[global_allocator] -static PEAK_ALLOC: PeakAlloc = PeakAlloc; +static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; /// Optimise circuits using Quartz-generated ECCs. /// From eb46b9362c9fbec11fc4d0ea24e6135009905124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Borgna?= <121866228+aborgna-q@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:15:39 +0100 Subject: [PATCH 2/3] Update taso-optimiser/Cargo.toml Co-authored-by: doug-q <141026920+doug-q@users.noreply.github.com> --- taso-optimiser/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taso-optimiser/Cargo.toml b/taso-optimiser/Cargo.toml index 5d82ccb7..31d69eed 100644 --- a/taso-optimiser/Cargo.toml +++ b/taso-optimiser/Cargo.toml @@ -17,7 +17,7 @@ tracing-subscriber = "0.3.17" tracing-appender = "0.2.2" peak_alloc = { version = "0.2.0", optional = true } -[target.'cfg(not(target_env = "msvc"))'.dependencies] +[target.'cfg(all(not(target_env = "msvc"), not(feature = "peak_alloc"))'.dependencies] tikv-jemallocator = "0.5" [features] From 8d6d094ef720862572bc4d0dc97decb72de219ea Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Tue, 24 Oct 2023 12:19:00 +0100 Subject: [PATCH 3/3] Undo checking features before depending on jemalloc --- taso-optimiser/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taso-optimiser/Cargo.toml b/taso-optimiser/Cargo.toml index 31d69eed..5d82ccb7 100644 --- a/taso-optimiser/Cargo.toml +++ b/taso-optimiser/Cargo.toml @@ -17,7 +17,7 @@ tracing-subscriber = "0.3.17" tracing-appender = "0.2.2" peak_alloc = { version = "0.2.0", optional = true } -[target.'cfg(all(not(target_env = "msvc"), not(feature = "peak_alloc"))'.dependencies] +[target.'cfg(not(target_env = "msvc"))'.dependencies] tikv-jemallocator = "0.5" [features]