-
Notifications
You must be signed in to change notification settings - Fork 473
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 Triekey to reduce allocations #8007
base: master
Are you sure you want to change the base?
Conversation
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.
Looks ok for me, but would like to hear @asdacap opinion
for (int i = 0; i < path.Length - 1; i += 2) | ||
{ | ||
output[i / 2 + 1] = | ||
path.Length % 2 == 0 | ||
? (byte)(16 * path[i] + path[i + 1]) | ||
: (byte)(16 * path[i + 1] + path[i + 2]); | ||
} |
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.
Can this be SIMD'ed?
for (int i = 0; i < byteLength; i++) | ||
{ | ||
pathSpan[i + pathSpanStart] = Nibbles.ToByte(nibbles[offset + i * 2], nibbles[offset + i * 2 + 1]); | ||
Length += 2; | ||
} |
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.
SIMD?
@@ -55,15 +55,15 @@ public void VisitBranch(TrieNode node, TrieVisitContext trieVisitContext) | |||
|
|||
public void VisitExtension(TrieNode node, TrieVisitContext trieVisitContext) | |||
{ | |||
_builder.AppendLine($"{GetPrefix(trieVisitContext)}EXTENSION {Nibbles.FromBytes(node.Key).ToPackedByteArray().ToHexString(false)} -> {KeccakOrRlpStringOfNode(node)}"); | |||
_builder.AppendLine($"{GetPrefix(trieVisitContext)}EXTENSION {Nibbles.FromBytes(node.Key.ToArray()).ToPackedByteArray().ToHexString(false)} -> {KeccakOrRlpStringOfNode(node)}"); |
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.
should Nibbles support FromKey
?
There should be a patricia tree benchmark somewhere. What is the result? |
Changes
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?