From fbb26546dd775d1f11923ad1d0f3cab11c993a23 Mon Sep 17 00:00:00 2001 From: Daniel Lubarov Date: Sun, 4 Dec 2022 10:15:28 -0800 Subject: [PATCH] Jemalloc for EVM Also update the version used elsewhere. --- README.md | 2 +- evm/Cargo.toml | 3 +++ evm/src/lib.rs | 8 ++++++++ plonky2/Cargo.toml | 2 +- system_zero/Cargo.toml | 2 +- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 59fc4d09..59ef6959 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ RUSTFLAGS=-Ctarget-cpu=native cargo run --release --example bench_recursion -- - ## Jemalloc -Plonky2 prefers the [Jemalloc](http://jemalloc.net) memory allocator due to its superior performance. To use it, include `jemallocator = "0.3.2"` in`Cargo.toml`and add the following lines +Plonky2 prefers the [Jemalloc](http://jemalloc.net) memory allocator due to its superior performance. To use it, include `jemallocator = "0.5.0"` in`Cargo.toml`and add the following lines to your `main.rs`: ```rust diff --git a/evm/Cargo.toml b/evm/Cargo.toml index 17d855c1..03850f7a 100644 --- a/evm/Cargo.toml +++ b/evm/Cargo.toml @@ -31,6 +31,9 @@ sha2 = "0.10.2" static_assertions = "1.1.0" tiny-keccak = "2.0.2" +[target.'cfg(not(target_env = "msvc"))'.dependencies] +jemallocator = "0.5.0" + [dev-dependencies] criterion = "0.4.0" hex = "0.4.3" diff --git a/evm/src/lib.rs b/evm/src/lib.rs index d311449b..4c368491 100644 --- a/evm/src/lib.rs +++ b/evm/src/lib.rs @@ -30,3 +30,11 @@ pub mod vanishing_poly; pub mod vars; pub mod verifier; pub mod witness; + +// Set up Jemalloc +#[cfg(not(target_env = "msvc"))] +use jemallocator::Jemalloc; + +#[cfg(not(target_env = "msvc"))] +#[global_allocator] +static GLOBAL: Jemalloc = Jemalloc; diff --git a/plonky2/Cargo.toml b/plonky2/Cargo.toml index ab131463..9474095e 100644 --- a/plonky2/Cargo.toml +++ b/plonky2/Cargo.toml @@ -46,7 +46,7 @@ structopt = { version = "0.3.26", default-features = false } tynm = { version = "0.1.6", default-features = false } [target.'cfg(not(target_env = "msvc"))'.dev-dependencies] -jemallocator = "0.3.2" +jemallocator = "0.5.0" [[bin]] name = "generate_constants" diff --git a/system_zero/Cargo.toml b/system_zero/Cargo.toml index 6a36ee25..58a5e489 100644 --- a/system_zero/Cargo.toml +++ b/system_zero/Cargo.toml @@ -23,4 +23,4 @@ name = "lookup_permuted_cols" harness = false [target.'cfg(not(target_env = "msvc"))'.dev-dependencies] -jemallocator = "0.3.2" +jemallocator = "0.5.0"