-
Notifications
You must be signed in to change notification settings - Fork 650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an LRU cache to make_trie_root_and_nodes() #573
Add an LRU cache to make_trie_root_and_nodes() #573
Conversation
50492fb
to
7ae56b3
Compare
Unfortunately this won't be enough by itself because we'd still be making one |
And caching |
So, this won't replace #565 but it might still be beneficial, specially since Byzantium blocks may have duplicate receipt_roots. Will benchmark to find out |
50b2479
to
0241726
Compare
Now that #565 has been merged and we're no longer generating/storing partial tx/receipt tries, it makes more sense to cache the whole thing here. |
0241726
to
99d3b3d
Compare
evm/db/trie.py
Outdated
# as it's common for them to have duplicate receipt_roots. Given that, it probably makes sense to | ||
# use a relatively small cache size here. | ||
@functools.lru_cache(128) | ||
def _make_trie_root_and_nodes(items: Tuple[bytes, ...]) -> Tuple[bytes, Dict]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return type should be Tuple[bytes, Dict[bytes, bytes]]
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I guess mypy considers a bare Dict
to be Dict[Any, Any]
99d3b3d
to
471af62
Compare
No description provided.