Skip to content

Instantly share code, notes, and snippets.

@mmcloughlin
Last active March 25, 2020 06:48
Show Gist options
  • Select an option

  • Save mmcloughlin/70598689ad2da5c6aadf19e30b6642a1 to your computer and use it in GitHub Desktop.

Select an option

Save mmcloughlin/70598689ad2da5c6aadf19e30b6642a1 to your computer and use it in GitHub Desktop.
goos: linux
goarch: amd64
pkg: crypto/cipher
BenchmarkAESGCMSeal1K-8 20815730 557 ns/op 1837.65 MB/s
BenchmarkAESGCMOpen1K-8 22296660 533 ns/op 1921.06 MB/s
BenchmarkAESGCMSign8K-8 5809227 2065 ns/op 3968.00 MB/s
BenchmarkAESGCMSeal8K-8 3583026 3364 ns/op 2434.99 MB/s
BenchmarkAESGCMOpen8K-8 3652791 3291 ns/op 2488.84 MB/s
BenchmarkAESCTR1K-8 4263354 2814 ns/op 362.08 MB/s
BenchmarkAESCTR8K-8 547248 21890 ns/op 374.01 MB/s
PASS
ok crypto/cipher 96.571s
#!/bin/bash -ex
ref=$1
repo="https://go.googlesource.com/go"
bench8kcommit="4a0dad211c2158e8763c6fd230fbdc1c7d566cb9"
benchtime="10s"
cwd=$(pwd)
# clone in temp dir
workdir=$(mktemp -d)
cd ${workdir}
git clone "${repo}"
cd go
# fetch cl reference
git fetch ${repo} ${ref}
git checkout FETCH_HEAD
# cherry pick the 8K benchmark
git cherry-pick --keep-redundant-commits ${bench8kcommit}
# make
cd src
./make.bash
cd ..
# test
./bin/go test crypto/aes crypto/cipher
# benchmark
output=${cwd}/${ref//\//_}_${benchtime}.out
./bin/go test -run NONE -bench '(CTR|GCM)' -benchtime ${benchtime} crypto/cipher | tee ${output}
# clean
cd ${cwd}
rm -rf ${workdir}
benchmark old ns/op new ns/op delta
BenchmarkAESGCMSeal1K-8 556 558 +0.36%
BenchmarkAESGCMOpen1K-8 530 534 +0.75%
BenchmarkAESGCMSign8K-8 2049 2045 -0.20%
BenchmarkAESGCMSeal8K-8 3366 3362 -0.12%
BenchmarkAESGCMOpen8K-8 3284 3289 +0.15%
BenchmarkAESCTR1K-8 671 376 -43.96%
BenchmarkAESCTR8K-8 4826 2294 -52.47%
benchmark old MB/s new MB/s speedup
BenchmarkAESGCMSeal1K-8 1840.43 1834.91 1.00x
BenchmarkAESGCMOpen1K-8 1929.99 1917.47 0.99x
BenchmarkAESGCMSign8K-8 3997.98 4005.84 1.00x
BenchmarkAESGCMSeal8K-8 2433.57 2436.21 1.00x
BenchmarkAESGCMOpen8K-8 2494.19 2490.21 1.00x
BenchmarkAESCTR1K-8 1516.47 2704.17 1.78x
BenchmarkAESCTR8K-8 1696.40 3568.81 2.10x
#!/bin/bash -ex
sudo ./prepare.sh
./bench.sh refs/changes/70/51670/4
./bench.sh refs/changes/96/136896/2
sudo ./reset.sh
benchcmp refs_changes_*.out > cmp.out
#!/bin/bash -ex
echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo
for cpu in /sys/devices/system/cpu/cpu[0-9]; do
echo performance > ${cpu}/cpufreq/scaling_governor
done
goos: linux
goarch: amd64
pkg: crypto/cipher
BenchmarkAESGCMSeal1K-8 30000000 556 ns/op 1840.43 MB/s
BenchmarkAESGCMOpen1K-8 30000000 530 ns/op 1929.99 MB/s
BenchmarkAESGCMSign8K-8 10000000 2049 ns/op 3997.98 MB/s
BenchmarkAESGCMSeal8K-8 5000000 3366 ns/op 2433.57 MB/s
BenchmarkAESGCMOpen8K-8 5000000 3284 ns/op 2494.19 MB/s
BenchmarkAESCTR1K-8 20000000 671 ns/op 1516.47 MB/s
BenchmarkAESCTR8K-8 3000000 4826 ns/op 1696.40 MB/s
PASS
ok crypto/cipher 129.776s
goos: linux
goarch: amd64
pkg: crypto/cipher
BenchmarkAESGCMSeal1K-8 30000000 558 ns/op 1834.91 MB/s
BenchmarkAESGCMOpen1K-8 30000000 534 ns/op 1917.47 MB/s
BenchmarkAESGCMSign8K-8 10000000 2045 ns/op 4005.84 MB/s
BenchmarkAESGCMSeal8K-8 5000000 3362 ns/op 2436.21 MB/s
BenchmarkAESGCMOpen8K-8 5000000 3289 ns/op 2490.21 MB/s
BenchmarkAESCTR1K-8 50000000 376 ns/op 2704.17 MB/s
BenchmarkAESCTR8K-8 10000000 2294 ns/op 3568.81 MB/s
PASS
ok crypto/cipher 140.878s
#!/bin/bash -ex
echo 0 > /sys/devices/system/cpu/intel_pstate/no_turbo
for cpu in /sys/devices/system/cpu/cpu[0-9]; do
echo powersave > ${cpu}/cpufreq/scaling_governor
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment