-
Notifications
You must be signed in to change notification settings - Fork 464
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
Reduce TrieNode allocations #5457
Conversation
Maybe I can change the implementation to use |
|
||
public byte[]? Data { get; } | ||
|
||
public int Position { get; set; } |
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.
If you want to micro op, I guess you can set this to a byte. Or it does not matter and overhead of casting it is higher.
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.
I think I'll leave as is. The stack is the stack one int or byte wont' make that much change. Also, I'll default to Rlp.ValueContext
for now.
Doing a full sync on teku mainnet. Once it's synced and working will confirm and merge if the results are consistent. |
The teku mainnet has been synced with this and now is operational. Waiting for a few hours of running and will be merging if nothing contradicts the findings above. |
I confirm that with the usage of the Rlp context reading the version behaves as it was with the copied |
This reverts commit 5488e31.
* _storageRoot as an array member * RlpStreamReader introduced * fixes and tests * benchmark refactored a bit * format * minor adjustements * the reader removed and usages replaced with Rlp.ValueDecoderContext
This PR removes 10% managed allocations from the node. It does it by moving
StorageRoot
fromTrieNode
as an item of an array and getting rid ofRlpStream
fromTrieNode
and delegating its functionality toRlp.ValueDecoderContext
Tests
Benchmarks
Reused
PatriciaTreeBenchmarks
that provides a coarse grained measurement of various operations.master
this PR
Running node
master
this PR
**Image** comparing of all the metrics
Changes
StorageRoot
is now stored as_data[2]
only in leafsRlpStreamReader
used instead of the object ofRlpStream
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Remarks
Another approach to the
TrieNode
optimization.