diff --git a/.dockerignore b/.dockerignore index ff7e653..83178d0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,6 +4,7 @@ serum_crank.tar serum_crank.tar.gz Makefile README.md +my-crank.log # regexs **/*.txt diff --git a/Cargo.lock b/Cargo.lock index 21fb13d..b9bba62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -558,6 +558,7 @@ dependencies = [ "clap 3.0.0-beta.4", "debug_print", "enumflags2", + "jemallocator", "log", "rand 0.7.3", "safe-transmute", @@ -1040,6 +1041,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs_extra" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -1575,6 +1582,27 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +[[package]] +name = "jemalloc-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45" +dependencies = [ + "cc", + "fs_extra", + "libc", +] + +[[package]] +name = "jemallocator" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69" +dependencies = [ + "jemalloc-sys", + "libc", +] + [[package]] name = "jobserver" version = "0.1.23" diff --git a/Cargo.toml b/Cargo.toml index 73528dc..327b601 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,7 @@ log = "0.4" debug_print = "1.0.0" tokio = {version = "0.2", features = ["full"]} warp = "0.2" +jemallocator = "0.3.2" [profile.release] lto = "fat" diff --git a/README.md b/README.md index 8bb3564..2b7be46 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Docker image for serum crank using maximal rust compiler optimizations. See [ser # Differences From Upstream * Specifies `--url` as the RPC to connect to instead of network which ends up using public rpc infra +* Forces global allocator to use jemalloc # Docker Image diff --git a/docker-compose.yml b/docker-compose.yml index a89b360..1ba9322 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,5 +12,4 @@ services: NUMWORKERS: 1 RPC_URL: "https://solana-api.projectserum.com" volumes: - - ./payer.json:/tmp/payer.json - - ./tulip_crank_logs:/logdir \ No newline at end of file + - ./payer.json:/tmp/payer.json \ No newline at end of file diff --git a/src/bin/main.rs b/src/bin/main.rs index 2433a20..ee71336 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -1,3 +1,6 @@ +#[global_allocator] +static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc; + use anyhow::Result; use clap::Clap; use crank::Opts;