paradigmxyz
reth
BlogDocsChangelog

fix(trie): Rewrite InMemoryTrieOverlay (with proptests!)

#19277Merged
Comparing
mediocregopher/in-mem-trie-overlay-fix
(
d288552
) with
main
(
be73e4a
)
CodSpeed Performance Gauge
0%
Untouched
77

Benchmarks

Passed

hash builder[init size 10000 | update size 100 | num updates 1]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
+4%
9.1 ms8.7 ms
hash builder[init size 10000 | update size 100 | num updates 10]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
+3%
88.5 ms86.1 ms
prefix set | size: 10 | `Vec` with binary search lookup
crates/trie/common/benches/prefix_set.rs::prefix_set::prefix_set_lookups::Prefix Set Lookups
CodSpeed Performance Gauge
+2%
3.8 µs3.7 µs
size 100000 | updated 1% | depth 3
crates/trie/sparse/benches/rlp_node.rs::rlp_node::update_rlp_node_level::update rlp node level
CodSpeed Performance Gauge
+1%
21.9 ms21.7 ms
hash builder[init size 1000 | update size 100 | num updates 5]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
+1%
12.2 ms12.1 ms
size 100000 | updated 1% | depth 5
crates/trie/sparse/benches/rlp_node.rs::rlp_node::update_rlp_node_level::update rlp node level
CodSpeed Performance Gauge
+1%
8.2 ms8.2 ms
hash builder[init size 10000 | update size 1000 | num updates 3]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
+1%
76.5 ms76 ms
hash builder[init size 1000 | update size 100 | num updates 10]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
+1%
24.2 ms24 ms
size 100000 | updated 1% | depth 2
crates/trie/sparse/benches/rlp_node.rs::rlp_node::update_rlp_node_level::update rlp node level
CodSpeed Performance Gauge
+1%
24.7 ms24.6 ms
size 100000 | updated 1% | depth 0
crates/trie/sparse/benches/rlp_node.rs::rlp_node::update_rlp_node_level::update rlp node level
CodSpeed Performance Gauge
+1%
24.9 ms24.7 ms
size 100000 | updated 1% | depth 1
crates/trie/sparse/benches/rlp_node.rs::rlp_node::update_rlp_node_level::update rlp node level
CodSpeed Performance Gauge
+1%
24.9 ms24.7 ms
hash builder[1000]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves::calculate root from leaves
CodSpeed Performance Gauge
0%
4.5 ms4.5 ms
validate_blob | num blobs: 6 | ValidateBlob
crates/primitives/benches/validate_blob_tx.rs::validate_blob::blob_validation::Blob Transaction KZG validation
CodSpeed Performance Gauge
0%
155 µs154.7 µs
prefix set | size: 100 | `Vec` with binary search lookup
crates/trie/common/benches/prefix_set.rs::prefix_set::prefix_set_lookups::Prefix Set Lookups
CodSpeed Performance Gauge
0%
19.1 µs19 µs
hash builder[init size 1000 | update size 1000 | num updates 5]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
28.1 ms28 ms
hash builder[init size 1000 | update size 1000 | num updates 10]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
55.9 ms55.9 ms
parallel hashing[100]
crates/trie/trie/benches/hash_post_state.rs::post_state::hash_post_state::Hash Post State
CodSpeed Performance Gauge
0%
257 ms256.7 ms
ordered_trie_root
crates/trie/trie/benches/trie_root.rs::benches::trie_root_benchmark::Receipts root calculation::receipts root | size: 10 | triehash
CodSpeed Performance Gauge
0%
132.1 µs131.9 µs
sequence hashing[100]
crates/trie/trie/benches/hash_post_state.rs::post_state::hash_post_state::Hash Post State
CodSpeed Performance Gauge
0%
256.9 ms256.7 ms
sparse trie[init size 1000 | update size 100 | num updates 3]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
3.3 ms3.3 ms
validate_blob | num blobs: 3 | ValidateBlob
crates/primitives/benches/validate_blob_tx.rs::validate_blob::blob_validation::Blob Transaction KZG validation
CodSpeed Performance Gauge
0%
151 µs150.9 µs
hash builder[init size 1000 | update size 100 | num updates 3]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
7.4 ms7.3 ms
sparse trie[5000]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves::calculate root from leaves
CodSpeed Performance Gauge
0%
28.4 ms28.4 ms
sparse trie[init size 1000 | update size 1000 | num updates 5]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
24.9 ms24.8 ms
sparse trie[init size 10000 | update size 100 | num updates 3]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
6.7 ms6.7 ms
sparse trie[init size 10000 | update size 1000 | num updates 5]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
55.7 ms55.7 ms
prefix set | size: 100 | `BTreeSet` with `Iterator:any` lookup
crates/trie/common/benches/prefix_set.rs::prefix_set::prefix_set_lookups::Prefix Set Lookups
CodSpeed Performance Gauge
0%
149.3 µs149.3 µs
sparse trie[init size 10000 | update size 1000 | num updates 1]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
11.6 ms11.6 ms
validate_blob | num blobs: 1 | ValidateBlob
crates/primitives/benches/validate_blob_tx.rs::validate_blob::blob_validation::Blob Transaction KZG validation
CodSpeed Performance Gauge
0%
149.8 µs149.7 µs
receipts root | size: 10 | HashBuilder
crates/trie/trie/benches/trie_root.rs::benches::trie_root_benchmark::Receipts root calculation
CodSpeed Performance Gauge
0%
112.3 µs112.3 µs
sparse trie[init size 10000 | update size 100 | num updates 10]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
21.9 ms21.9 ms
hash builder[5000]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves::calculate root from leaves
CodSpeed Performance Gauge
0%
22.3 ms22.3 ms
sparse trie[init size 10000 | update size 1000 | num updates 10]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
110.9 ms110.9 ms
sparse trie[init size 1000 | update size 1000 | num updates 3]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
15 ms15 ms
prefix set | size: 1000 | `BTreeSet` with `Iterator:any` lookup
crates/trie/common/benches/prefix_set.rs::prefix_set::prefix_set_lookups::Prefix Set Lookups
CodSpeed Performance Gauge
0%
14.9 ms14.9 ms
sparse trie[init size 10000 | update size 100 | num updates 5]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
11.1 ms11.1 ms
ordered_trie_root
crates/trie/trie/benches/trie_root.rs::benches::trie_root_benchmark::Receipts root calculation::receipts root | size: 100 | triehash
CodSpeed Performance Gauge
0%
1.2 ms1.2 ms
validate_blob | num blobs: 2 | ValidateBlob
crates/primitives/benches/validate_blob_tx.rs::validate_blob::blob_validation::Blob Transaction KZG validation
CodSpeed Performance Gauge
0%
149.8 µs149.8 µs
sequence hashing[1000]
crates/trie/trie/benches/hash_post_state.rs::post_state::hash_post_state::Hash Post State
CodSpeed Performance Gauge
0%
2.6 s2.6 s
prefix set | size: 10 | `BTreeSet` with `Iterator:any` lookup
crates/trie/common/benches/prefix_set.rs::prefix_set::prefix_set_lookups::Prefix Set Lookups
CodSpeed Performance Gauge
0%
3.8 µs3.8 µs
ordered_trie_root
crates/trie/trie/benches/trie_root.rs::benches::trie_root_benchmark::Receipts root calculation::receipts root | size: 1000 | triehash
CodSpeed Performance Gauge
0%
11.8 ms11.8 ms
recover ECDSA
crates/primitives/benches/recover_ecdsa_crit.rs::benches::criterion_benchmark
CodSpeed Performance Gauge
0%
206.4 µs206.4 µs
prefix set | size: 1000 | `Vec` with binary search lookup
crates/trie/common/benches/prefix_set.rs::prefix_set::prefix_set_lookups::Prefix Set Lookups
CodSpeed Performance Gauge
0%
198.2 µs198.2 µs
receipts root | size: 100 | HashBuilder
crates/trie/trie/benches/trie_root.rs::benches::trie_root_benchmark::Receipts root calculation
CodSpeed Performance Gauge
0%
937.6 µs937.8 µs
hash builder[init size 1000 | update size 1000 | num updates 3]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
16.9 ms16.9 ms
validate_blob | num blobs: 4 | ValidateBlob
crates/primitives/benches/validate_blob_tx.rs::validate_blob::blob_validation::Blob Transaction KZG validation
CodSpeed Performance Gauge
0%
151.9 µs152 µs
sparse trie[1000]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves::calculate root from leaves
CodSpeed Performance Gauge
0%
5.7 ms5.7 ms
sparse trie[init size 1000 | update size 100 | num updates 10]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
10.7 ms10.7 ms
sparse trie[init size 10000 | update size 100 | num updates 1]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
2.3 ms2.3 ms
sparse trie[init size 1000 | update size 100 | num updates 5]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
5.4 ms5.4 ms
sparse trie[init size 10000 | update size 1000 | num updates 3]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
33.7 ms33.7 ms
parallel hashing[1000]
crates/trie/trie/benches/hash_post_state.rs::post_state::hash_post_state::Hash Post State
CodSpeed Performance Gauge
0%
2.6 s2.6 s
prefix set | size: 1000 | `BTreeSet` with `BTreeSet:range` lookup
crates/trie/common/benches/prefix_set.rs::prefix_set::prefix_set_lookups::Prefix Set Lookups
CodSpeed Performance Gauge
0%
465.5 µs465.7 µs
receipts root | size: 1000 | HashBuilder
crates/trie/trie/benches/trie_root.rs::benches::trie_root_benchmark::Receipts root calculation
CodSpeed Performance Gauge
0%
9.1 ms9.1 ms
prefix set | size: 1000 | `Vec` with custom cursor lookup
crates/trie/common/benches/prefix_set.rs::prefix_set::prefix_set_lookups::Prefix Set Lookups
CodSpeed Performance Gauge
0%
138.2 µs138.4 µs
hash builder[init size 1000 | update size 100 | num updates 1]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
2.4 ms2.5 ms
sparse trie[init size 1000 | update size 1000 | num updates 10]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
49.5 ms49.5 ms
sparse trie[init size 1000 | update size 100 | num updates 1]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
1.1 ms1.1 ms
prefix set | size: 100 | `BTreeSet` with `BTreeSet:range` lookup
crates/trie/common/benches/prefix_set.rs::prefix_set::prefix_set_lookups::Prefix Set Lookups
CodSpeed Performance Gauge
0%
40.2 µs40.2 µs
prefix set | size: 100 | `Vec` with custom cursor lookup
crates/trie/common/benches/prefix_set.rs::prefix_set::prefix_set_lookups::Prefix Set Lookups
CodSpeed Performance Gauge
0%
16.1 µs16.1 µs
validate_blob | num blobs: 5 | ValidateBlob
crates/primitives/benches/validate_blob_tx.rs::validate_blob::blob_validation::Blob Transaction KZG validation
CodSpeed Performance Gauge
0%
153.2 µs153.6 µs
hash builder[init size 1000 | update size 1000 | num updates 1]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
5.6 ms5.6 ms
sparse trie[init size 1000 | update size 1000 | num updates 1]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
0%
5.1 ms5.1 ms
hash builder[init size 10000 | update size 1000 | num updates 10]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
-1%
250 ms251.4 ms
prefix set | size: 10 | `BTreeSet` with `BTreeSet:range` lookup
crates/trie/common/benches/prefix_set.rs::prefix_set::prefix_set_lookups::Prefix Set Lookups
CodSpeed Performance Gauge
-1%
5 µs5.1 µs
size 100000 | updated 1% | depth 4
crates/trie/sparse/benches/rlp_node.rs::rlp_node::update_rlp_node_level::update rlp node level
CodSpeed Performance Gauge
-1%
11.3 ms11.4 ms
hash builder[init size 10000 | update size 1000 | num updates 5]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
-1%
124.6 ms125.7 ms
prefix set | size: 10 | `Vec` with custom cursor lookup
crates/trie/common/benches/prefix_set.rs::prefix_set::prefix_set_lookups::Prefix Set Lookups
CodSpeed Performance Gauge
-1%
3.1 µs3.1 µs
size 100000 | updated 0.1% | depth 1
crates/trie/sparse/benches/rlp_node.rs::rlp_node::update_rlp_node_level::update rlp node level
CodSpeed Performance Gauge
-2%
3.6 ms3.7 ms
size 100000 | updated 0.1% | depth 0
crates/trie/sparse/benches/rlp_node.rs::rlp_node::update_rlp_node_level::update rlp node level
CodSpeed Performance Gauge
-2%
3.6 ms3.7 ms
size 100000 | updated 0.1% | depth 2
crates/trie/sparse/benches/rlp_node.rs::rlp_node::update_rlp_node_level::update rlp node level
CodSpeed Performance Gauge
-2%
3.5 ms3.5 ms
size 100000 | updated 0.1% | depth 3
crates/trie/sparse/benches/rlp_node.rs::rlp_node::update_rlp_node_level::update rlp node level
CodSpeed Performance Gauge
-2%
2.4 ms2.5 ms
hash builder[init size 10000 | update size 1000 | num updates 1]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
-3%
25.1 ms25.8 ms
size 100000 | updated 0.1% | depth 4
crates/trie/sparse/benches/rlp_node.rs::rlp_node::update_rlp_node_level::update rlp node level
CodSpeed Performance Gauge
-3%
1.3 ms1.4 ms
hash builder[init size 10000 | update size 100 | num updates 3]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
-3%
26.2 ms27 ms
size 100000 | updated 0.1% | depth 5
crates/trie/sparse/benches/rlp_node.rs::rlp_node::update_rlp_node_level::update rlp node level
CodSpeed Performance Gauge
-3%
1 ms1.1 ms
hash builder[init size 10000 | update size 100 | num updates 5]
crates/trie/sparse/benches/root.rs::root::calculate_root_from_leaves_repeated::calculate root from leaves repeated
CodSpeed Performance Gauge
-3%
42.6 ms44 ms

Commits

Click on a commit to change the comparison range
Base
main
be73e4a
+0.1%
fix(trie): Rewrite InMemoryTrieOverlay (with proptests!) The `InMemoryTrieOverlay::next` method was previously very broken, in that it did not ever descend into lower parts of the trie. For example a given current key of `0xA`, and subsequent keys of `0xA0` and `0xB`, `next` was returning `0xB`. This was due to incorrect usage of the `Nibbles::increment` method. Fixing this issue involved essentially rewriting the entire type. The new implementation includes proptests to ensure that it functions correctly. Some extra debug checks have also been added to ensure that the overlay is actually being used correctly.
d34a5d0
6 days ago
by mediocregopher
+10.09%
doc fixes
888af31
6 days ago
by mediocregopher
-10.15%
rename next_inner
799862e
5 days ago
by mediocregopher
-0.21%
Merge remote-tracking branch 'upstream/main' into mediocregopher/in-mem-trie-overlay-fix
d288552
3 days ago
by mediocregopher
© 2025 CodSpeed Technology
Home Terms Privacy Docs