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

feat: Optimize bech32 Encoding Performance #119

Conversation

juandiegocv27
Copy link

Optimized the Bech32 encoding implementation for better performance and efficiency:

-Constant ALPHABET: Defined ALPHABET as a global constant for Bech32 characters.
-Memory Preallocation: Preallocated memory for the encoded result in the encode function.
-Use of while Loops: Used while loops for controlled iteration in compliance with Cairo's constraints.
-Optimized byte-to-5-bit Conversion: Improved convert_bytes_to_5bit_chunks function with more efficient bitwise -operations.
-Optimized Checksum Calculation: Enhanced the checksum function for better array handling and efficiency.

These changes address the performance improvements requested in issue #74.

Before and After:
-Function convert_bytes_to_5bit_chunks After:
image
Before:
image

Function encode After:
image
Before:
image

Any suggestions are welcome, and I'm happy to make any changes you need. @maciejka @mubarak23

Copy link

vercel bot commented May 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
joyboy ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 28, 2024 2:12am
joyboy-webapp ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 28, 2024 2:12am

Copy link
Collaborator

@maciejka maciejka left a comment

Choose a reason for hiding this comment

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

Please make your code compile.

@maciejka maciejka marked this pull request as draft May 28, 2024 08:27
This pull request was closed.
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