perf: traverse trie keys with a nibble cursor instead of materializing nibbles#647
perf: traverse trie keys with a nibble cursor instead of materializing nibbles#647Qumeric wants to merge 1 commit into
Conversation
28604d5 to
e8d6f42
Compare
fc5f491 to
6129977
Compare
e8d6f42 to
89e650d
Compare
29cc1c8 to
54edd21
Compare
fbf68b6 to
657bc05
Compare
657bc05 to
fb6dac3
Compare
fb6dac3 to
6fca225
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Every
get/insert/deleteconverted its key into a 64-nibbleSmallVecup front (~64 bounds-checked pushes per operation), leaf comparison walked nibble by nibble, and new leaf paths were packed nibble by nibble — across the tens of thousands of trie operations in a block this adds up to a significant share of guest instructions.Traversal now uses a
KeyNibblescursor: a(key bytes, nibble offset)pair that computes nibbles by shift/mask on demand.encoded_path_from_key) are a one-byte prefix plus a direct copy of the key's remaining bytes, instead of a nibble-packing loop.Node-path operations (
prefix_to_nibs, split/merge path construction) are unchanged — they operate on stored paths, not lookup keys.Benchmark results
OpenVM 2.1 / new default block
Compare-branches run vs
develop-v2.1.0: 29742009056 (block 24001988, prove-stark, g7e.2xlarge):develop-v2.1.0execute_metered_insnstotal_cellsrowstotal_proof_time_msreth-block_time_msPrevious: OpenVM 2.0 / old default block
These historical runs used the previous OpenVM 2.0 branch and old default block 23992138. They are retained for context and are not directly comparable to the OpenVM 2.1 results above.
Compare-branches run vs
main(which now includes #644): 29086324164 (block 23992138, prove-stark, g7e.2xlarge):execute_metered_insnstotal_cellsrowstotal_proof_time_msreth-block_time_ms(An earlier run against the pre-#644/#648/#649/#650 base showed −11.2M insns / −2.23% cells: 28864942969; the instruction saving carried over fully to the leaner base.)
The
compare-resultsjob failed only on the known artifact-path issue (#632); numbers were aggregated from the run artifacts directly.