Optimize various (de)serializations#19
Merged
fspreiss merged 41 commits intodfinity:mainfrom Apr 21, 2026
Merged
Conversation
* sorted imports * dot-notation when available * consistent return statements
…into optimization
Better readability
* Improve Base58.decode to batches of 8 characters * Improve Bse58.encode to batches of 7 bytes * Optimize Segwit.mo by avoiding List and iters
…o-bitcoin into optimize-with-batching
…o-bitcoin into optimize-with-batching
But only in the hottest path, where it is worth it, to not affect readability elsewhere.
fspreiss
previously approved these changes
Apr 21, 2026
Contributor
fspreiss
left a comment
There was a problem hiding this comment.
Thanks for the optimizations!
Review dismissed by automation script.
fspreiss
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR does not noticeably improve cryptographic operations. It is only useful for users who use the package for its (de)serialization functions (Bech32, Base58). A similar optimzation via batching had been recently done for Base64 in core.
This PR still has the bench.yml workflow inside it which commits benchmark.md in a GitHub action. We will remove it just before merging.