Reduce stratch space needed by ecmult_strauss_wnaf. - #899
Conversation
f44de02 to
44e44a6
Compare
44e44a6 to
3bb7260
Compare
fcb614a to
4ba9971
Compare
4ba9971 to
6d5f1de
Compare
commented
Mar 29, 2021
6d5f1de to
59745ee
Compare
commented
Apr 6, 2021
|
@real-or-random observes that |
59745ee to
c9bd399
Compare
commented
May 12, 2021
|
Rebased and updated |
c9bd399 to
1cd7ab2
Compare
commented
Aug 28, 2021
|
rebased. |
left a comment
There was a problem hiding this comment.
Concept ACK, secp256k1_ecmult_strauss_wnaf indeed uses scratch space more efficiently with this change.
I ran ./bench_ecmult strauss_wnaf at both 1cd7ab2 and 9a5a87e just to make sure there's no obvious regression in running time.
Unfortunately it looks like this might have some merge conflicts with #638 depending on which gets merged first.
| * The omitted z-coordinate are implied by the final a value's z-coordinate and the zr array. | ||
| */ | ||
| static void secp256k1_ecmult_odd_multiples_table(int n, secp256k1_gej *prej, secp256k1_fe *zr, const secp256k1_gej *a) { | ||
| static void secp256k1_ecmult_odd_multiples_table(int n, secp256k1_ge *pre_a, secp256k1_fe *zr, secp256k1_gej *a) { |
There was a problem hiding this comment.
Style nit (feel free to ignore): Instead of making a mutable, would it make sense to have an output parameter for the final z value, since that's the only part of a that gets read later?
There was a problem hiding this comment.
I have learned that returning structures is frowned upon in C.
There was a problem hiding this comment.
Oh yeah, I agree with you about that. What I was suggesting is to have an extra parameter to the function that's a pointer like secp256k1_fe *global_z (or maybe z_final), instead of updating a in place.
There was a problem hiding this comment.
Done. I'm a little tempted to take z as an input and rescale the a value by its value, but it is probably best to leave it as is.
80fc6f1 to
ae33232
Compare
left a comment
There was a problem hiding this comment.
OK, I took another look and I think I have a better understanding now. This PR looks pretty solid.
I left a few suggestions for comments / style, mostly because I thought some parts were confusing even before your PR. If you prefer I can also push them to some branch as a follow-up commit.
ae33232 to
5aea2e8
Compare
commented
Dec 8, 2021
|
Thanks @robot-dreams. I've taken your suggestions and made some minor adjustments to them. |
5aea2e8 to
b6ed302
Compare
commented
Dec 10, 2021
|
ACK b6ed302 |
b6ed302 to
9d2c777
Compare
4c14457 to
b797a50
Compare
commented
Jan 19, 2022
|
I've rearranged the code a little bit and rewritten the comments a bit. |
commented
Jan 25, 2022
|
ACK b797a50 |
No description provided.