-
-
Notifications
You must be signed in to change notification settings - Fork 603
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
Improve Base62 encoding/decoding performance and robustness #3391
base: main
Are you sure you want to change the base?
Improve Base62 encoding/decoding performance and robustness #3391
Conversation
…avoiding dynamic memory usage for small, fixed-size data
… avoid less precise floating point operations
…nt overflow of uint32 The current implementation could produce incorrect results for very long input strings
… a fixed-size array for O(1) lookups, improving performance and reducing memory overhead
|
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.
Pull Request Overview
This PR improves Base62 encoding and decoding performance while enhancing robustness and error handling. Key changes include:
- Optimized encoding by using a fixed-size buffer and iterative multiplication.
- Improved decoding with a fixed-size lookup array, added overflow and invalid character checks.
- Expanded unit tests to cover edge cases including empty input, overflow, and invalid characters.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
base62/base62.go | Refactored encoding/decoding logic for performance and robustness. |
base62/base62_test.go | Added comprehensive tests for encoding/decoding, error handling. |
Describe your changes
Performance & Robustness Enhancements
Testing Improvements:
Issue ticket number and link
Checklist