openssl
openssl copied to clipboard
Update performance documentation.
The "performance" section in the documentation has not been updated since April 2014. Running the benchmarks today with go 1.7 and 1.8, it seems this library is slower than the stdlib in all but one benchmark (BenchmarkSHA256Large_*
):
Go 1.8:
$ go version
go version go1.8.1 darwin/amd64
$ go test -bench=. -ldflags=-s
# github.com/spacemonkeygo/openssl
ld: warning: directory not found for option '-L/usr/local/opt/[email protected]/lib'
# github.com/spacemonkeygo/openssl
ld: warning: directory not found for option '-L/usr/local/opt/[email protected]/lib'
BenchmarkSHA256HMAC-4 2000000 979 ns/op
BenchmarkSHA1Large_openssl-4 2000 1161567 ns/op 902.72 MB/s
BenchmarkSHA1Large_stdlib-4 1000 1125683 ns/op 931.50 MB/s
BenchmarkSHA1Small_openssl-4 1000000 1774 ns/op 0.56 MB/s
BenchmarkSHA1Small_stdlib-4 10000000 206 ns/op 4.85 MB/s
BenchmarkSHA256Large_openssl-4 500 2560554 ns/op 409.51 MB/s
BenchmarkSHA256Large_stdlib-4 500 2934527 ns/op 357.32 MB/s
BenchmarkSHA256Small_openssl-4 500000 2017 ns/op 0.50 MB/s
BenchmarkSHA256Small_stdlib-4 5000000 286 ns/op 3.49 MB/s
BenchmarkStdlibThroughput-4 200000 7676 ns/op 133.40 MB/s
BenchmarkOpenSSLThroughput-4 50000 32563 ns/op 31.45 MB/s
BenchmarkStdlibOpenSSLThroughput-4 200000 8320 ns/op 123.07 MB/s
BenchmarkOpenSSLStdlibThroughput-4 300000 5981 ns/op 171.19 MB/s
PASS
ok github.com/spacemonkeygo/openssl 104.153s
Go 1.7:
$ go version
go version go1.7.5 darwin/amd64
$ go test -bench=. -ldflags=-s
# github.com/spacemonkeygo/openssl
ld: warning: directory not found for option '-L/usr/local/opt/[email protected]/lib'
# github.com/spacemonkeygo/openssl
ld: warning: directory not found for option '-L/usr/local/opt/[email protected]/lib'
BenchmarkSHA256HMAC-4 1000000 1352 ns/op
BenchmarkSHA1Large_openssl-4 2000 1251402 ns/op 837.92 MB/s
BenchmarkSHA1Large_stdlib-4 2000 1101072 ns/op 952.32 MB/s
BenchmarkSHA1Small_openssl-4 500000 2579 ns/op 0.39 MB/s
BenchmarkSHA1Small_stdlib-4 10000000 202 ns/op 4.93 MB/s
BenchmarkSHA256Large_openssl-4 500 2456446 ns/op 426.87 MB/s
BenchmarkSHA256Large_stdlib-4 500 2891912 ns/op 362.59 MB/s
BenchmarkSHA256Small_openssl-4 500000 2962 ns/op 0.34 MB/s
BenchmarkSHA256Small_stdlib-4 5000000 277 ns/op 3.60 MB/s
BenchmarkStdlibThroughput-4 200000 6965 ns/op 147.01 MB/s
BenchmarkOpenSSLThroughput-4 50000 33866 ns/op 30.24 MB/s
BenchmarkStdlibOpenSSLThroughput-4 200000 6940 ns/op 147.53 MB/s
BenchmarkOpenSSLStdlibThroughput-4 200000 6994 ns/op 146.40 MB/s
PASS
ok github.com/spacemonkeygo/openssl 97.231s
Unless you run on ARM: On ARM 32-bit, spacemonkey is 10x faster than stdlib for my server.