From 8761072977c9c302a8fa8a3d95cc34fadba4c299 Mon Sep 17 00:00:00 2001 From: Shashank Trivedi <100513286+lordshashank@users.noreply.github.com> Date: Sat, 13 Jan 2024 04:41:29 +0530 Subject: [PATCH] asm-keccak added (#5997) Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> --- Makefile | 2 +- bin/reth/Cargo.toml | 6 ++++++ book/installation/source.md | 15 ++++++++++----- crates/primitives/Cargo.toml | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index c3ea8f6db..38b710110 100644 --- a/Makefile +++ b/Makefile @@ -231,4 +231,4 @@ update-book-cli: ## Update book cli documentation. .PHONY: maxperf maxperf: - RUSTFLAGS="-C target-cpu=native" cargo build --profile maxperf --features jemalloc + RUSTFLAGS="-C target-cpu=native" cargo build --profile maxperf --features jemalloc,asm-keccak diff --git a/bin/reth/Cargo.toml b/bin/reth/Cargo.toml index b5e726cd3..ae8427b85 100644 --- a/bin/reth/Cargo.toml +++ b/bin/reth/Cargo.toml @@ -125,13 +125,18 @@ procfs = { version = "0.16.0" } [features] default = ["jemalloc"] + +asm-keccak = ["reth-primitives/asm-keccak"] + jemalloc = ["dep:jemallocator", "dep:jemalloc-ctl"] jemalloc-prof = ["jemalloc", "jemallocator?/profiling"] + min-error-logs = ["tracing/release_max_level_error"] min-warn-logs = ["tracing/release_max_level_warn"] min-info-logs = ["tracing/release_max_level_info"] min-debug-logs = ["tracing/release_max_level_debug"] min-trace-logs = ["tracing/release_max_level_trace"] + optimism = [ "reth-primitives/optimism", "reth-revm/optimism", @@ -149,6 +154,7 @@ optimism = [ "reth-optimism-payload-builder/optimism", "reth-ethereum-payload-builder/optimism", ] + # no-op feature flag for switching between the `optimism` and default functionality in CI matrices ethereum = [] diff --git a/book/installation/source.md b/book/installation/source.md index 89893c9da..d8cb10205 100644 --- a/book/installation/source.md +++ b/book/installation/source.md @@ -102,13 +102,18 @@ RUSTFLAGS="-C target-cpu=native" cargo build --profile maxperf **Features** -Finally, some features may improve performance on your system, most notably `jemalloc`, which replaces the default memory allocator used by reth. +Finally, some optional features are present that may improve performance, but may not very portable, +and as such might not compile on your particular system. These are currently: +- `jemalloc`: replaces the default system memory allocator with [`jemalloc`](https://jemalloc.net/); this feature is unstable on Windows +- `asm-keccak`: replaces the default, pure-Rust implementation of Keccak256 with one implemented in assembly; see [the `keccak-asm` crate](https://github.com/DaniPopes/keccak-asm) for more details and supported targets +- `min-LEVEL-logs`, where `LEVEL` is one of `error`, `warn`, `info`, `debug`, `trace`: disables compilation of logs of lower level than the given one; this in general isn't that significant, and is not recommended due to the loss of debugging that the logs would provide -You can enable features by passing them to the `--features` Cargo flag. +You can activate features by passing them to the `--features` or `-F` Cargo flag; +multiple features can be activated with a space- or comma-separated list to the flag: -> **Note** -> -> The `jemalloc` feature is unstable on Windows due to jemallocator itself. +```bash +RUSTFLAGS="-C target-cpu=native" cargo build --profile maxperf --features jemalloc,asm-keccak +``` ## Troubleshooting diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 7d123e888..d380b71b4 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -91,6 +91,7 @@ secp256k1.workspace = true [features] default = ["c-kzg"] +asm-keccak = ["alloy-primitives/asm-keccak"] arbitrary = [ "revm-primitives/arbitrary", "reth-rpc-types/arbitrary",