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
Increase by x4.8 performance of ToHexString #5009
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.
Would it make sense to optimize ByteArrayToHexViaLookup32Safe
in similar way too or it is already optimal? It is used when serializing Address
, Bloom
, Keccak
and byte[]
?
At some point in the future I think we should do a little cleanup and remove obsolete implementations.
Can put in a quick change #5011; and do some more fancy stuff with intrinsics also |
Is now x4.8 times faster, and Bytes.ByteArrayToHexViaLookup32Safe, Bytes.ToHexString and SpanExtensions.ToHexString all share the same implementation, rather than having 3 different ones
|
SafeLookup is improved x1.12 so it hasn't regressed from sharing the method
|
6b54380
to
5536e45
Compare
.NET 7 is now in master branch |
5536e45
to
8e7f9af
Compare
Added the vectorized path which improves the
|
3a3d1b2
to
213434a
Compare
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 had to write notes to review this, LOL. This is beyond my paygrade 😄 .
thank you @benaadams 🙏 |
Changes:
Is now x4.8 times faster, and Bytes.ByteArrayToHexViaLookup32Safe, Bytes.ToHexString and SpanExtensions.ToHexString all share the same implementation, rather than having 3 different ones
Types of changes
What types of changes does your code introduce?
Put an
x
in the boxes that applyTesting
Requires testing
In case you checked yes, did you write tests??
Comments about testing , should you have some (optional)
Added some odd/even leading zeros tests
Further comments (optional)
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...