Closed
Bug 1294461
Opened 8 years ago
Closed 8 years ago
mpp_sieve incorrectly records composites and slows down prime number generation
Categories
(NSS :: Libraries, defect)
NSS
Libraries
Tracking
(Not tracked)
RESOLVED
FIXED
3.27
People
(Reporter: ttaubert, Assigned: ttaubert)
References
Details
Attachments
(1 file)
993 bytes,
patch
|
franziskus
:
review+
|
Details | Diff | Splinter Review |
mpp_sieve() takes a list of prime numbers (which is static and precompiled) and a random number $x. It then takes these primes and marks every number after $x that's divisible by one of these small primes as a composite. It looks like the implementer tried to have us only record values for odd numbers after $x but that's now what we do. In mpp_make_prime() below we then take the sieved numbers and check/discard the wrong ones. With this fixed I get a ~2.6x speedup when generating primes. cert.sh and chains.sh run a lot faster, which is nice.
Assignee | ||
Comment 1•8 years ago
|
||
Here's a small patch that speeds up prime number generation by a factor of ~2.6. The good thing is that it doesn't touch the algorithm itself but simply makes us discard the right numbers (composites) instead of possible prime candidates.
Attachment #8780147 -
Flags: review?(franziskuskiefer)
Assignee | ||
Comment 2•8 years ago
|
||
Build times look great: https://treeherder.mozilla.org/#/jobs?repo=nss-try&revision=fa12946dc98eef0c5a01fc885b2dfc43c7b9ebe7&filter-tier=1&filter-tier=2&filter-tier=3
Assignee | ||
Comment 3•8 years ago
|
||
The Chains tests on ARM finished in 106 and 134 minutes, that's definitely a huge improvement. And wrt bug 1272818, we seem to be even faster than Chrome when generating RSA keys with the WebCrypto API.
Comment 4•8 years ago
|
||
Comment on attachment 8780147 [details] [diff] [review] 0001-Bug-1294461-Fix-mpp_sieve-to-correctly-record-compos.patch Review of attachment 8780147 [details] [diff] [review]: ----------------------------------------------------------------- awesome!
Attachment #8780147 -
Flags: review?(franziskuskiefer) → review+
Comment 5•8 years ago
|
||
https://hg.mozilla.org/projects/nss/rev/f8b37bbd8432
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.27
You need to log in
before you can comment on or make changes to this bug.
Description
•