Files
xgcl/sm/sm3/sm3_amd64_test.go
T
2026-05-27 23:03:00 +08:00

31 lines
549 B
Go

package sm3_test
import (
"testing"
"xdx.jelly/xgcl/sm/sm3"
)
// BenchmarkBlockGeneric 性能测试
func BenchmarkBlockGeneric(b *testing.B) {
d := sm3.NewDigest()
buf := make([]byte, 10*1024*1024)
b.SetBytes(int64(len(buf)))
b.ResetTimer()
for i := 0; i < b.N; i++ {
sm3.BlockGeneric(d, buf)
}
}
// BenchmarkBlockAVX2 性能测试
func BenchmarkBlockAVX2(b *testing.B) {
d := sm3.NewDigest()
buf := make([]byte, 10*1024*1024)
b.SetBytes(int64(len(buf)))
b.ResetTimer()
for i := 0; i < b.N; i++ {
sm3.BlockAsmAVX2(d, buf)
}
}