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

Optimize sha functions #602

Open
3 tasks
Acaccia opened this issue Jan 14, 2025 · 0 comments
Open
3 tasks

Optimize sha functions #602

Acaccia opened this issue Jan 14, 2025 · 0 comments

Comments

@Acaccia
Copy link
Collaborator

Acaccia commented Jan 14, 2025

Currently, the sha256, sha512 and hash160 functions are written in Wat in the standard. This implementation however brings a few optimization issues:

  1. The code for those functions is included in the standard and always copied to the generated binaries
  2. Both those functions need a large array of magic number for their internal operations which are always present in the linear memory
  3. The functions are written to be as short as possible, but would be way more efficient if we unrolled the loops, remove the Simd instructions, remove the internal function calls, remove the call_indirect, ...

We should reimplement them with walrus to generate once when needed those standard functions, write the magic numbers in memory and have all the optimizations and more from point 3.

  • sha256
  • sha512
  • hash160
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Status: 🆕 New
Development

No branches or pull requests

1 participant