Skip to content

Commit 29f66fe

Browse files
authored
perf: enable asm feature on sha2 (#768)
## πŸ“ Summary `sha2::Sha256` with asm feature enabled is 85% faster than the vanilla sha2 and slightly faster than `ring`. ## βœ… I have completed the following steps: * [x] Run `make lint` * [x] Run `make test` * [ ] Added tests (if applicable)
1 parent 1cc7b47 commit 29f66fe

File tree

7 files changed

+165
-103
lines changed

7 files changed

+165
-103
lines changed

β€ŽCargo.lockβ€Ž

Lines changed: 31 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€ŽCargo.tomlβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ prost = "0.13"
179179
prost-types = "0.13"
180180
exponential-backoff = "1.2.0"
181181
derivative = "2.2"
182+
sha2 = "0.10.8"
182183

183184
libc = { version = "0.2.161" }
184185
lazy_static = "1.4.0"
@@ -189,6 +190,9 @@ ahash = "0.8.6"
189190
time = { version = "0.3.36", features = ["macros", "formatting", "parsing"] }
190191
uuid = { version = "1.6.1", features = ["serde", "v5", "v4"] }
191192

193+
criterion = "0.5.1"
194+
proptest = "1.5"
195+
192196
eth-sparse-mpt = { path = "crates/eth-sparse-mpt" }
193197
bid-scraper = { path = "crates/bid-scraper" }
194198
rbuilder = { path = "crates/rbuilder" }

β€Žcrates/bid-scraper/Cargo.tomlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ strum = { version = "0.25", features = ["derive"] }
6363
exponential-backoff.workspace = true
6464

6565
[dev-dependencies]
66-
proptest = "1.4"
66+
proptest.workspace = true

β€Žcrates/eth-sparse-mpt/Cargo.tomlβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ flate2 = { workspace = true, optional = true }
5050
benchmark-utils = ["dep:hash-db", "dep:triehash", "dep:flate2"]
5151

5252
[dev-dependencies]
53-
criterion = { version = "0.4", features = ["html_reports"] }
53+
criterion = { workspace = true, features = ["html_reports"] }
5454
rand = { workspace = true, features = ["small_rng"] }
55-
proptest = "1.5.0"
55+
proptest.workspace = true
5656
eth-sparse-mpt = { path = ".", features = ["benchmark-utils"] }
5757

5858
[[bench]]

β€Žcrates/rbuilder-primitives/Cargo.tomlβ€Ž

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ typenum = "1.17.0"
4040
# misc
4141
derivative.workspace = true
4242
integer-encoding = "4.0.0"
43-
sha2 = "0.10.8"
43+
sha2 = { workspace = true, features = ["asm"] }
4444
uuid = { version = "1.6.1", features = ["serde", "v5", "v4"] }
4545
governor = "0.6.3"
4646
ahash.workspace = true
@@ -56,4 +56,12 @@ derive_more.workspace = true
5656
serde_json.workspace = true
5757

5858
[dev-dependencies]
59+
alloy-primitives = { workspace = true, features = ["arbitrary"] }
5960
rand.workspace = true
61+
criterion.workspace = true
62+
proptest.workspace = true
63+
ring = "0.17"
64+
65+
[[bench]]
66+
name = "sha_pair"
67+
harness = false

0 commit comments

Comments
Β (0)