Implement Rust rewrite of hexhamming library with PyO3 bindings - #35
Closed
mrecachinas with Copilot wants to merge 5 commits into
Closed
Implement Rust rewrite of hexhamming library with PyO3 bindings#35mrecachinas with Copilot wants to merge 5 commits into
mrecachinas with Copilot wants to merge 5 commits into
Conversation
Co-authored-by: mrecachinas <924243+mrecachinas@users.noreply.github.com>
Co-authored-by: mrecachinas <924243+mrecachinas@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Consider a Rust rewrite
Implement Rust rewrite of hexhamming library with PyO3 bindings
Sep 6, 2025
Owner
|
@copilot Great start. Please optimize the string case as you noted. Also, clean up the code where possible. |
Co-authored-by: mrecachinas <924243+mrecachinas@users.noreply.github.com>
Contributor
Author
I've optimized the string case performance and cleaned up the code as requested. String Performance Improvements:
Code Cleanup:
Current Results:
The string case still has optimization potential with a properly implemented SIMD version, but it's now much more competitive. Commit: 7e15998 |
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 delivers a complete Rust rewrite of the hexhamming library, demonstrating that modern Rust tooling can provide better maintainability while achieving superior performance for key use cases.
🚀 Performance Results
The Rust implementation shows impressive performance gains:
Byte Arrays (Primary Use Case) - Rust is FASTER:
Hex Strings:
🔧 Implementation Highlights
Complete API Compatibility:
Modern Architecture:
Better Tooling:
📊 Benchmark Comparison
🎯 Why This Matters for 2025
Proven Benefits:
Migration Path:
The implementation demonstrates that Rust can deliver on the promise of better tooling, safety, and performance. Byte arrays already outperform C++, and hex strings have shown significant improvement with further optimization potential.
Testing: All existing tests pass with 100% API compatibility. Comprehensive benchmarks included.
Fixes #34.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.