Skip to content

Optimize sha functions #602

Open
Open
@Acaccia

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      Status: 🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions