Update README to reflect AVX2 support for crypto/sha256
frankw
6 years ago
0 | 0 | # sha256-simd |
1 | 1 | |
2 | 2 | Accelerate SHA256 computations in pure Go for both Intel (AVX2, AVX, SSE) as well as ARM (arm64) platforms. |
3 | ||
4 | Update: As of Go 1.8, `crypto/sha256` offers similar performance for AVX2. | |
3 | 5 | |
4 | 6 | ## Introduction |
5 | 7 | |
45 | 47 | | 2.4 GHz Intel Xeon CPU E5-2620 v3 | minio/sha256-simd (AVX2) | 355.0 MB/s | 1.88x | |
46 | 48 | | 2.4 GHz Intel Xeon CPU E5-2620 v3 | minio/sha256-simd (AVX) | 306.0 MB/s | 1.62x | |
47 | 49 | | 2.4 GHz Intel Xeon CPU E5-2620 v3 | minio/sha256-simd (SSE) | 298.7 MB/s | 1.58x | |
48 | | 2.4 GHz Intel Xeon CPU E5-2620 v3 | crypto/sha256 | 189.2 MB/s | | | |
49 | 50 | | 1.2 GHz ARM Cortex-A53 | crypto/sha256 | 6.1 MB/s | | |
50 | 51 | |
51 | 52 | Note that the AVX2 version is measured with the "unrolled"/"demacro-ed" version. Due to some Golang assembly restrictions the AVX2 version that uses `defines` loses about 15% performance (you can see the macrofied version, which is a little bit easier to read, [here](https://github.com/minio/sha256-simd/blob/e1b0a493b71bb31e3f1bf82d3b8cbd0d6960dfa6/sha256blockAvx2_amd64.s)). |
118 | 119 | |
119 | 120 | Example performance metrics were generated on Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz - 6 physical cores, 12 logical cores running Ubuntu GNU/Linux with kernel version 4.4.0-24-generic (vanilla with no optimizations). |
120 | 121 | |
121 | ### AVX2 | |
122 | ||
123 | ``` | |
124 | $ benchcmp go.txt avx2.txt | |
125 | benchmark old ns/op new ns/op delta | |
126 | BenchmarkHash8Bytes-12 446 364 -18.39% | |
127 | BenchmarkHash1K-12 5919 3279 -44.60% | |
128 | BenchmarkHash8K-12 43791 23655 -45.98% | |
129 | BenchmarkHash1M-12 5544989 2969305 -46.45% | |
130 | ||
131 | benchmark old MB/s new MB/s speedup | |
132 | BenchmarkHash8Bytes-12 17.93 21.96 1.22x | |
133 | BenchmarkHash1K-12 172.98 312.27 1.81x | |
134 | BenchmarkHash8K-12 187.07 346.31 1.85x | |
135 | BenchmarkHash1M-12 189.10 353.14 1.87x | |
136 | ``` | |
137 | ||
138 | 122 | ### AVX |
139 | 123 | |
140 | 124 | ``` |