secp256k1-zkp
secp256k1-zkp copied to clipboard
Document scratch space requirements
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.
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?
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.
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.