-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sshutil: prioritize aes128-gcm@openssh.com when AES acceleration is available (roughly 60% faster on Intel Mac) #299
Conversation
15535c3
to
d1c08eb
Compare
Unfortunately I cannot reproduce the speedup. Maybe the CPU is too old, but it does support AES instructions:
I've manually verified that ssh will use
and can switch to
For comparison I've been copying a 200MB file inside $ time cp a0 a1
real 0m1.268s
user 0m0.008s
sys 0m0.085s
$ time cp a0 a2
real 0m0.953s
user 0m0.009s
sys 0m0.083s
$ time cp a0 a3
real 0m1.505s
user 0m0.009s
sys 0m0.089s Running inside the default instance, it runs in about 25s (I've double-checked that the sshfs commands don't specify a cipher): jan@lima-default:/tmp/lima$ time cp a0 a1
real 0m25.017s
user 0m0.024s
sys 0m15.393s
jan@lima-default:/tmp/lima$ time cp a0 a2
real 0m25.242s
user 0m0.012s
sys 0m15.750s
jan@lima-default:/tmp/lima$ time cp a0 a3
real 0m23.573s
user 0m0.013s
sys 0m14.892s Running one more time with a build compiled from this PR (I've verified that the ciphers are requested in the sshfs commands) shows identical times within the margin of error: jan@lima-default:/tmp/lima$ time cp a0 a1
real 0m25.865s
user 0m0.013s
sys 0m15.533s
jan@lima-default:/tmp/lima$ time cp a0 a2
real 0m24.179s
user 0m0.000s
sys 0m15.009s
jan@lima-default:/tmp/lima$ time cp a0 a3
real 0m23.917s
user 0m0.012s
sys 0m14.851s And I did I guess I need to do the |
Unfortunately same results. If anything the AES version is slightly slower (using a different git repo): $ time git diff
real 0m0.047s
user 0m0.019s
sys 0m0.097s
$ time git diff
real 0m0.051s
user 0m0.020s
sys 0m0.110s
$ time git diff
real 0m0.050s
user 0m0.021s
sys 0m0.079s
# on master
jan@lima-default:/Users/jan/git/perl$ time git diff
real 0m11.487s
user 0m2.130s
sys 0m2.910s
jan@lima-default:/Users/jan/git/perl$ time git diff
real 0m9.700s
user 0m1.847s
sys 0m1.964s
jan@lima-default:/Users/jan/git/perl$ time git diff
real 0m9.769s
user 0m1.824s
sys 0m2.226s
jan@lima-default:/Users/jan/git/perl$ time git diff
real 0m9.726s
user 0m1.879s
sys 0m1.967s
# on aesni branch
jan@lima-default:/Users/jan/git/perl$ time git diff
real 0m19.773s
user 0m2.035s
sys 0m4.217s
jan@lima-default:/Users/jan/git/perl$ time git diff
real 0m10.239s
user 0m1.620s
sys 0m2.571s
jan@lima-default:/Users/jan/git/perl$ time git diff
real 0m10.232s
user 0m1.851s
sys 0m2.180s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though I cannot repro the performance gains, the PR looks correct to me. I assume that the aes code makes uses of other new CPU features that my older CPU is lacking, even though it does have support for AES. At least it doesn't seem to get slower on my machine.
Still rather sad that file copy is 15× and |
Some folks are collecting aes-128-gcm seems faster than chacha20-poly1305 , even on M1 Mac? MacBook Air (M1)https://gist.github.com/voluntas/fd279c7b4e71f9950cfd4a5ab90b722b#gistcomment-3535685
Mac mini (M1)https://gist.github.com/voluntas/fd279c7b4e71f9950cfd4a5ab90b722b#gistcomment-3784432
|
…ailable By default, `ssh` chooses chacha20-poly1305@openssh.com, even when AES accelerator is available. (OpenSSH_8.1p1, macOS 11.6, MacBookPro 2020, Core i7-1068NG7) AES accelerator is available on almost all recent Intel and AMD processors, but not on all ARM processors. Probably available on Apple M1 too. Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Updated PR to prioritize |
By default,
ssh
chooseschacha20-poly1305@openssh.com
, even when AES acceleration is available.(OpenSSH_8.1p1, macOS 11.6, MacBookPro 2020, Core i7-1068NG7)
AES accelerator is available on almost all recent Intel and AMD processors, but not on all ARM processors.
Probably available on Apple M1 too. (#299 (comment))
Benchmark
sshfs becomes roughly 60% faster on Intel Mac.
Before
After
Host info