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

Make comparison of Unsliced values more efficient #658

Merged
merged 1 commit into from
Mar 31, 2025

Conversation

jeltsch
Copy link
Collaborator

@jeltsch jeltsch commented Mar 27, 2025

This pull requests makes comparisons of Unsliced values more efficient by avoiding conversions of byte arrays to vectors and instead using conversions to short byte strings. This also opens the opportunity to have comparisons of Unsliced values for underlying data types other than SerialisedKey, and this pull request introduces a corresponding generalization. Note, however, that this latter change implies that comparison now works by directly comparing the underlying byte arrays using the methods of ShortByteString; any Ord instantiation of the underlying data type is ignored. As of now, this doesn’t make a difference for SerialisedKey, as SerialisedKey values are compared using the methods of RawBytes, which work like the ones for ShortByteString.

Copy link
Collaborator

@jorisdral jorisdral left a comment

Choose a reason for hiding this comment

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

Nice! I added two commits with suggestions, let me know what you think.

@jeltsch
Copy link
Collaborator Author

jeltsch commented Mar 28, 2025

Nice! I added two commits with suggestions, let me know what you think.

Glad that you’re happy. 🙂

Both your suggestions make perfect sense to me. I’ll keep them both.

Let me squash and rebase the branch. Please accept this pull request if your happy with it.

@jeltsch jeltsch force-pushed the jeltsch/efficient-unsliced-comparison branch from 4f60acd to 47573dd Compare March 28, 2025 17:36
@jeltsch
Copy link
Collaborator Author

jeltsch commented Mar 28, 2025

Let me squash and rebase the branch.

Done.

@jorisdral jorisdral added this pull request to the merge queue Mar 31, 2025
Merged via the queue into main with commit 2f995b2 Mar 31, 2025
27 checks passed
@jorisdral jorisdral deleted the jeltsch/efficient-unsliced-comparison branch March 31, 2025 11:40
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