AES performance in Go 1.6 ARM

890 views
Skip to first unread message

Artem Andreenko

unread,
Feb 2, 2016, 5:52:18 PM2/2/16
to golang-dev
Hi!

My name is Artem. I'm developer of open-source distributed private networking Meshbird. For developing purpose I have tested performance of AES-CBC & AES-GCM on different platforms and Go versions.

I have very strange results for ARM:

Benchmark result for Go 1.5.3 ARM (unofficial from Dave Cheney website):

BenchmarkEncryptAesCbc-4          100000            351569 ns/op           4.10 MB/s
--- BENCH: BenchmarkEncryptAesCbc-4
        crypt_test.go:35: encryption speed: 20.60 Mbit/s
        crypt_test.go:35: encryption speed: 30.81 Mbit/s
        crypt_test.go:35: encryption speed: 31.06 Mbit/s
        crypt_test.go:35: encryption speed: 31.25 Mbit/s
BenchmarkDescryptAesCbc-4         100000            352585 ns/op           4.08 MB/s
--- BENCH: BenchmarkDescryptAesCbc-4
        crypt_test.go:63: decryption speed: 19.17 Mbit/s
        crypt_test.go:63: decryption speed: 30.86 Mbit/s
        crypt_test.go:63: decryption speed: 31.20 Mbit/s
        crypt_test.go:63: decryption speed: 31.16 Mbit/s
BenchmarkEncryptAESGCM-4           30000            812110 ns/op           1.85 MB/s
--- BENCH: BenchmarkEncryptAESGCM-4
        crypt_test.go:88: aes-gcm speed: 12.02 Mbit/s
        crypt_test.go:88: aes-gcm speed: 13.73 Mbit/s
        crypt_test.go:88: aes-gcm speed: 14.20 Mbit/s
        crypt_test.go:88: aes-gcm speed: 14.09 Mbit/s


Benchmark results for Go 1.6rc1 ARM (from official website):

BenchmarkEncryptAesCbc-4           50000            530105 ns/op           2.72 MB/s
--- BENCH: BenchmarkEncryptAesCbc-4
        crypt_test.go:35: encryption speed: 12.19 Mbit/s
        crypt_test.go:35: encryption speed: 20.68 Mbit/s
        crypt_test.go:35: encryption speed: 20.89 Mbit/s
        crypt_test.go:35: encryption speed: 20.72 Mbit/s
BenchmarkDescryptAesCbc-4          50000            528610 ns/op           2.72 MB/s
--- BENCH: BenchmarkDescryptAesCbc-4
        crypt_test.go:63: decryption speed: 13.50 Mbit/s
        crypt_test.go:63: decryption speed: 20.51 Mbit/s
        crypt_test.go:63: decryption speed: 20.76 Mbit/s
        crypt_test.go:63: decryption speed: 20.78 Mbit/s
BenchmarkEncryptAESGCM-4           20000           1210917 ns/op           1.24 MB/s
--- BENCH: BenchmarkEncryptAESGCM-4
        crypt_test.go:88: aes-gcm speed: 8.47 Mbit/s
        crypt_test.go:88: aes-gcm speed: 9.52 Mbit/s
        crypt_test.go:88: aes-gcm speed: 9.39 Mbit/s
        crypt_test.go:88: aes-gcm speed: 9.45 Mbit/s

Results for Go 1.5 on Macbook 2,5 GHz Intel Core i7:

BenchmarkEncryptAesCbc-8    10000000          3806 ns/op     378.28 MB/s
--- BENCH: BenchmarkEncryptAesCbc-8
    crypt_test.go:35: encryption speed: 195.63 Mbit/s
    crypt_test.go:35: encryption speed: 2981.15 Mbit/s
    crypt_test.go:35: encryption speed: 3131.80 Mbit/s
    crypt_test.go:35: encryption speed: 3094.25 Mbit/s
    crypt_test.go:35: encryption speed: 2886.02 Mbit/s
BenchmarkDescryptAesCbc-8    5000000          4041 ns/op     356.34 MB/s
--- BENCH: BenchmarkDescryptAesCbc-8
    crypt_test.go:63: decryption speed: 535.53 Mbit/s
    crypt_test.go:63: decryption speed: 2656.16 Mbit/s
    crypt_test.go:63: decryption speed: 2500.70 Mbit/s
    crypt_test.go:63: decryption speed: 2738.80 Mbit/s
    crypt_test.go:63: decryption speed: 2718.67 Mbit/s
BenchmarkEncryptAESGCM-8     2000000         13353 ns/op     112.33 MB/s
--- BENCH: BenchmarkEncryptAESGCM-8
    crypt_test.go:88: aes-gcm speed: 446.27 Mbit/s
    crypt_test.go:88: aes-gcm speed: 842.11 Mbit/s
    crypt_test.go:88: aes-gcm speed: 762.20 Mbit/s
    crypt_test.go:88: aes-gcm speed: 829.11 Mbit/s
    crypt_test.go:88: aes-gcm speed: 856.99 Mbit/s

Results for Go 1.5 on Macbook 2,5 GHz Intel Core i7:

BenchmarkEncryptAesCbc-8     5000000          3728 ns/op     386.24 MB/s
--- BENCH: BenchmarkEncryptAesCbc-8
    crypt_test.go:35: encryption speed: 156.32 Mbit/s
    crypt_test.go:35: encryption speed: 2843.10 Mbit/s
    crypt_test.go:35: encryption speed: 2801.33 Mbit/s
    crypt_test.go:35: encryption speed: 2960.51 Mbit/s
    crypt_test.go:35: encryption speed: 2946.80 Mbit/s
BenchmarkDescryptAesCbc-8    5000000          3825 ns/op     376.41 MB/s
--- BENCH: BenchmarkDescryptAesCbc-8
    crypt_test.go:63: decryption speed: 394.88 Mbit/s
    crypt_test.go:63: decryption speed: 2788.22 Mbit/s
    crypt_test.go:63: decryption speed: 2738.45 Mbit/s
    crypt_test.go:63: decryption speed: 2877.10 Mbit/s
    crypt_test.go:63: decryption speed: 2871.81 Mbit/s
BenchmarkEncryptAESGCM-8    20000000          1120 ns/op    1338.69 MB/s
--- BENCH: BenchmarkEncryptAESGCM-8
    crypt_test.go:88: aes-gcm speed: 755.83 Mbit/s
    crypt_test.go:88: aes-gcm speed: 6333.48 Mbit/s
    crypt_test.go:88: aes-gcm speed: 8512.81 Mbit/s
    crypt_test.go:88: aes-gcm speed: 10307.68 Mbit/s
    crypt_test.go:88: aes-gcm speed: 10213.39 Mbit/s


Regards,
Artem.





Brad Fitzpatrick

unread,
Feb 2, 2016, 5:57:51 PM2/2/16
to Artem Andreenko, golang-dev
What are your unexpected results?

You dumped a lot of numbers, but didn't say what you found odd.

You also didn't specify which of Dave Cheney's many build variants you used.


--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dave Cheney

unread,
Feb 2, 2016, 6:00:15 PM2/2/16
to Brad Fitzpatrick, Artem Andreenko, golang-dev

I don't think there is much to be surprised about here, amd64 has all those hash algos in asm, arm32 uses pure go.

Uli Kunitz

unread,
Feb 2, 2016, 6:39:40 PM2/2/16
to golang-dev, brad...@golang.org, mio...@gmail.com
On AMD64  AES New Instructions are used. According to Wikipedia ARMv8 has comparable instructions. On first sight it appears odd that performance degraded from 1.5.3 to 1.6rc1.

Dave Cheney

unread,
Feb 2, 2016, 6:47:11 PM2/2/16
to Uli Kunitz, golang-dev, brad...@golang.org, mio...@gmail.com

To focus on the issue, this bug is a regression in crypto performance on arm32 between 1.5 and 1.6.

Can you check the go1 benchmarks (test/bench/go1) on your system to give us a data point if go1.6 is slower as a whole on arm, or its just crypto that is affected.


On Wed, 3 Feb 2016, 10:39 Uli Kunitz <uli.k...@gmail.com> wrote:
On AMD64  AES New Instructions are used. According to Wikipedia ARMv8 has comparable instructions. On first sight it appears odd that performance degraded from 1.5.3 to 1.6rc1.

--

Artem Andreenko

unread,
Feb 2, 2016, 8:53:57 PM2/2/16
to golang-dev, mio...@gmail.com


On Wednesday, February 3, 2016 at 1:57:51 AM UTC+3, Brad Fitzpatrick wrote:
What are your unexpected results? 

You dumped a lot of numbers, but didn't say what you found odd.

You also didn't specify which of Dave Cheney's many build variants you used.

Unexpected results are performance fall on Go 1.6 ARM compared to Go 1.5 ARM. I've used this build http://dave.cheney.net/paste/go1.5.3.linux-arm.tar.gz

Artem Andreenko

unread,
Feb 2, 2016, 8:55:59 PM2/2/16
to golang-dev
Last block of benchmark results for Go 1.6.

Brad Fitzpatrick

unread,
Feb 2, 2016, 9:29:28 PM2/2/16
to Artem Andreenko, golang-dev
Feel free to file a bug about ARM AES performance if you want to subscribe to updates. This email thread will almost certainly get lost. We only track bugs, and not emails.

I imagine the ARM codegen changed slighly somehow and really hurt ARM on this benchmark. Or maybe some alignment is getting unlucky.

In any case, we don't typically track ARM performance over time, and this isn't a blocker for Go 1.6.

Maybe in Go 1.7 or Go 1.8 we'll have an SSA backend for ARM and things will improve. Or an AES assembly implementation for ARM.



Aram Hăvărneanu

unread,
Feb 3, 2016, 4:47:18 AM2/3/16
to Uli Kunitz, golang-dev, Brad Fitzpatrick, mio...@gmail.com
On Wed, Feb 3, 2016 at 12:39 AM, Uli Kunitz <uli.k...@gmail.com> wrote:
> According to Wikipedia ARMv8 has comparable instructions.

GOOS=arm is not ARMv8, GOOS=arm64 is. Arm64 will get AES instruction
support in 1.7.

--
Aram Hăvărneanu

Zhongwei Yao

unread,
Feb 3, 2016, 5:27:53 AM2/3/16
to Aram Hăvărneanu, golang-dev
@Aram,  I find there is AES instruction in current assembler, but there is no SIMD load and store instruction yet (and also a lot of other SIMD instruction missing). So what does get AES instruction support exactly mean?

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Best regards,
Zhongwei

Aram Hăvărneanu

unread,
Feb 3, 2016, 5:30:35 AM2/3/16
to Zhongwei Yao, golang-dev
On Wed, Feb 3, 2016 at 11:27 AM, Zhongwei Yao <zhongw...@linaro.org> wrote:
> @Aram, I find there is AES instruction in current assembler, but there is
> no SIMD load and store instruction yet (and also a lot of other SIMD
> instruction missing). So what does get AES instruction support exactly mean?

It means support in the standard library.

--
Aram Hăvărneanu
Reply all
Reply to author
Forward
0 new messages