M1 跑 openssl speed 测试, rosetta 竟然速度快好多

2022-04-19 15:35:33 +08:00
 keyfunc

这算逆优化么 😂

结果:

arch -arm64e openssl speed -evp aes-256-gcm

LibreSSL 2.8.3
built on: date not available
options:bn(64,64) rc4(ptr,int) des(idx,cisc,16,int) aes(partial) blowfish(idx) 
compiler: information not available
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
aes-256-gcm     143582.05k   146068.54k   143675.00k   143172.47k   143065.32k

arch -x86_64 openssl speed -evp aes-256-gcm

LibreSSL 2.8.3
built on: date not available
options:bn(64,64) rc4(16x,int) des(idx,cisc,16,int) aes(partial) blowfish(idx) 
compiler: information not available
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
aes-256-gcm     513189.06k  1466338.36k  1692859.34k  1656888.24k  1660308.10k
2506 次点击
所在节点    Apple
7 条回复
xtinput
2022-04-19 15:37:42 +08:00
我的 M1Max 和你这个数据差不多
keyfunc
2022-04-19 16:16:17 +08:00
```
OpenSSL 1.1.1n 15 Mar 2022
built on: Tue Mar 15 14:37:47 2022 UTC
options:bn(64,64) rc4(int) des(int) aes(partial) idea(int) blowfish(ptr)
compiler: clang -fPIC -arch arm64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -D_REENTRANT -DNDEBUG
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes
aes-256-gcm 1001410.93k 2674462.35k 4020612.61k 4051648.47k 3813676.37k 3968878.79k
```

重新用 OpenSSL 跑了下,好像自带的 LibreSSL 有点问题
linusyang
2022-04-19 16:32:13 +08:00
LibreSSL 没有 arm64 的汇编优化,只有 x86_64 的。OpenSSL 的指令集优化多一点。
xtinput
2022-04-19 16:48:55 +08:00
version: 3.0.2
built on: Tue Mar 15 14:30:24 2022 UTC
options: bn(64,64)
compiler: clang -fPIC -arch arm64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -D_REENTRANT -DOPENSSL_BUILDING_OPENSSL -DNDEBUG
CPUINFO: OPENSSL_armcap=0x7f
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes
AES-256-GCM 933194.39k 2587635.29k 4097587.80k 4664237.94k 5703328.13k 5812055.75k
linusyang
2022-04-19 16:58:46 +08:00
另外可以用自带的试试 aes-128-gcm ,貌似有优化。
MrKrabs
2022-04-19 16:59:35 +08:00
keyfunc
2022-04-19 17:14:34 +08:00
@linusyang 是的,好像 128 很快,原生比 rosetta 快了,差距并不大
LibreSSL rosetta
aes-128-gcm 1531638.85k 5946102.75k 23789147.19k 95029256.18k 760820812.43k

LibreSSL 原生
aes-128-gcm 2220132.69k 8950815.61k 35738367.40k 143223969.26k 1145713507.08k

OpenSSL
aes-128-gcm 1129241.01k 3110185.88k 4705038.08k 4669664.39k 4536124.82k

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/847914

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX