casper-network / casper-network/casper-node

[spike] Discovery of possible optimization of a Trie structure for a prefix iterator

Open
#4,089 3 comments 0 reactions 2 assignees Claimed by @fizyk20 View on GitHub
storage
Dominant language
Rust
Stars
399
Forks
224
Avg merge
15h 44m
Merged PRs (30d)
2

Description

As implemented currently the Trie enum has two major variants: Leaf, which contains K, and V, and a Node which contains 255 pointers in a trie. Each pointer in the Node variant is either Leaf pointer or Node pointer. In the prefix iterator implementation when we descend into the requested prefix we have to also navigate all the trie pointer’s to get the actual Key value based on the matching prefix. The idea of this discovery ticket is to determine if we can optimize this by moving K from Trie::Leaf variant into the LeafPointer variant inside pointer block, so we can short circuit the last step, and just return the K from the LeafPointer without reading another Trie object at a pointer to get that K. We know for a fact that random IO on the slowest supported machine is super slow which led us to implement the batching migration mechanism, so we think this is worth measuring at least before making decision.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.