Skip to content

Slow crypto operations (WebCryptoAPI support) #554

Open
@r-l-x

Description

@r-l-x

Crypto operations are really slow with gopherjs.
Here is a small benchmark, consisting of hashing a 10MB buffer through SHA-256: http://www.gopherjs.org/playground/#/X98vxh8Y97

  • native go: about 120ms
  • gopherjs: about 1400ms under Chrome, 1900ms under Firefox

Depending on the type of operation, the difference can be even bigger. Issue #526 mentions 300x slower operations for RSA signatures.

I think it would be really great if crypto operations were implemented by calling the WebCryptoAPI.
As an exemple, here is a simple POC, with the same operation implemented with WebCrypto: http://www.gopherjs.org/playground/#/-_Ed7QocdZ
The execution times are:

  • Chrome (you have to load it over HTTPS): about 50ms
  • Firefox: about 70ms

That's about 25x as fast as the current version, and even twice as fast as a native go program!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions