Skip to content

Commit

Permalink
asm-keccak added (#5997)
Browse files Browse the repository at this point in the history
Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
  • Loading branch information
lordshashank and DaniPopes authored Jan 12, 2024
1 parent e67567c commit 8761072
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions bin/reth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 = []

Expand Down
15 changes: 10 additions & 5 deletions book/installation/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 8761072

Please sign in to comment.