-
Notifications
You must be signed in to change notification settings - Fork 18k
crypto/rsa: RSA key generation is unreasonably slow on MIPS architecture #33224
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
Comments
same issue here |
Dumped a CPU profile
The Go
Compared to a
To make the comparison fair - disabled asm optimisations for the bechmarks:
|
Note that we currently have no MIPS builders (#31217). Builders are required per the porting policy. I don't think anyone is planning to work on this, and without builders to check for regressions I don't see how we could reasonably accept MIPS-specific changes at the moment. |
Is it possible to run builders on |
See #31217 (comment). Is |
Depends on the optimisations, but generally if you take Also, before even considering optimisations it would be nice to make the code work at least OKish, which So, I would say, in the absence of real hw, |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?What did you do?
Created a simple benchmark for generating RSA keys. Made some adjustments to make the algorithm deterministic, so the benchmark time is independent from the value of the input random seed
rsa_test.go
Compile the above and run on a target platform:
What did you expect to see?
Seconds to generate RSA keys
What did you see instead?
Minutes (closer to hours) to generate 2048 and 4096 RSA keys
For comparison, generating 4096-bit key with
openssl
3 times on the same QEMU instance:Additional info
It seems the key generation time on MIPS grows disproportionally with the requested key size. Fun fact: for 4096-bit keys it is ~1.75 faster to emulate ARM on MIPS than to run MIPS code directly.
NOTE: for below simulations I used Go
1.10
, because later versions of Go are notqemu-user
emulator friendly (probably, because of #24656). The test OS in question: Debian Stretch x86_64.Compile the above test and run under
qemu-mipsel-static
emulatorCompile the same code, but for arm and run it on
qemu-arm-static
emulator compiled formipsle
(which I just downloaded from official Debian MIPS stretch repositories) and running onqemu-mipsel-static
emulator (double emulation):As we can see it makes almost no difference for 2048-bit keys with double emulation through arm and 4096-bit keys are even faster when emulated with arm.
The text was updated successfully, but these errors were encountered: