Skip to content
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 branches in HexPrefix.FromBytes #7596

Merged
merged 2 commits into from
Oct 13, 2024
Merged

Reduce branches in HexPrefix.FromBytes #7596

merged 2 commits into from
Oct 13, 2024

Conversation

benaadams
Copy link
Member

Changes

  • Absorb odd outside loop
  • Use 16bit LUT to do two nibbles at a time

Types of changes

What types of changes does your code introduce?

  • Optimization

Testing

Requires testing

  • No


ref byte byteRef = ref MemoryMarshal.GetReference(bytes);
ref ushort lookup16 = ref MemoryMarshal.GetArrayDataReference(Lookup16);
for (int i = 0; i < nibbles.Length; i++)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks SIMD'able?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it needs a deeper look; like do we need to expand to nibbles and convert back at all? 🤔

@benaadams benaadams merged commit 837065c into master Oct 13, 2024
73 checks passed
@benaadams benaadams deleted the frombytes branch October 13, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants