opencontainers / go-digest

Common digest package used across the container ecosystem
https://www.opencontainers.org/
Other
185 stars 59 forks source link

consider using sha256-simd #71

Closed rchincha closed 1 year ago

rchincha commented 2 years ago

Considering the impressive perf gains, thoughts about pulling this in?

https://github.com/minio/sha256-simd

AkihiroSuda commented 2 years ago

SGTM

AkihiroSuda commented 2 years ago

@rchincha Do you plan to submit a PR?

rchincha commented 2 years ago

@AkihiroSuda perhaps best to wait for this discussion to resolve. https://github.com/golang/go/issues/50543

howardjohn commented 2 years ago

The concerns on the Go issues are mostly around licensing. I think https://github.com/minio/sha256-simd/ is a different implementation that is apache2 licensed?

I pulled in the same library into go-containerregistry, which we use to build our images, and it was over 2x speedup in pushing images, so a huge improvement

rchincha commented 2 years ago

Yes, and as I see it, couple of decisions to make here: 1) this perf improvement applicable only if CPU has sha_ni extensions available, and 2) do you want to wait for this to land in golang proper instead (for better support perhaps).

AkihiroSuda commented 1 year ago

This might suffice to enable the simdized hasher:

package example

import (
  "crypto"
  sha256simd "github.com/minio/sha256-simd"
)

func init() {
  crypto.RegisterHash(crypto.SHA256, sha256simd.New)
}

e.g.,