secp256k1-zkp icon indicating copy to clipboard operation
secp256k1-zkp copied to clipboard

Document scratch space requirements

Open DavidBurkett opened this issue 6 years ago • 3 comments

This is probably a silly question, but how does one go about determining the scratch space size necessary? I'm trying to consume secp256k1_schnorrsig_verify_batch but can't find any documentation on how to determine the appropriate scratch space size.

DavidBurkett avatar May 31 '19 23:05 DavidBurkett

Not a silly question at all!

What do you mean by appropriate? Any scratch space size should work. More scratch space makes the function faster up to a certain point depending on the number of signatures to verify.

Perhaps we need a function that takes a number of signatures and returns the smallest scratch space size that maximizes the speed of batch_verify?

jonasnick avatar Jun 01 '19 06:06 jonasnick

Yes, a function like that is exactly what I'm looking for! In the meantime, a formula for calculating the smallest size that gives optimal performance would be very helpful.

DavidBurkett avatar Jun 01 '19 19:06 DavidBurkett

That's a pretty long formula and writing it out is almost as time consuming as making a PR with such a function. In the meantime you can use whatever you're comfortable with as there are diminishing returns anyway. If you have a specific workload you can also benchmark your implementation to check at which point you won't get a speedup anymore.

jonasnick avatar Jun 02 '19 21:06 jonasnick