Add benchmark
This commit is contained in:
parent
092165a5f4
commit
fc868ffd27
|
@ -84,6 +84,35 @@ import {aggCount, runs} from "./params";
|
|||
runs,
|
||||
});
|
||||
|
||||
// Verify multiple signatures
|
||||
|
||||
await runBenchmark<{pks: PublicKey[]; msgs: Uint8Array[]; sigs: Signature[]}, boolean>({
|
||||
id: `${implementation} verifyMultipleSignatures (${aggCount})`,
|
||||
|
||||
prepareTest: () => {
|
||||
const dataArr = range(aggCount).map(() => {
|
||||
const sk = bls.SecretKey.fromKeygen();
|
||||
const pk = sk.toPublicKey();
|
||||
const msg = randomMessage();
|
||||
const sig = sk.sign(msg);
|
||||
return {pk, msg, sig};
|
||||
});
|
||||
|
||||
const pks = dataArr.map((data) => data.pk);
|
||||
const msgs = dataArr.map((data) => data.msg);
|
||||
const sigs = dataArr.map((data) => data.sig);
|
||||
|
||||
return {
|
||||
input: {pks, msgs, sigs},
|
||||
resultCheck: (valid) => valid === true,
|
||||
};
|
||||
},
|
||||
testRunner: ({pks, msgs, sigs}) => {
|
||||
return bls.Signature.verifyMultipleSignatures(pks, msgs, sigs);
|
||||
},
|
||||
runs,
|
||||
});
|
||||
|
||||
// Aggregate pubkeys
|
||||
|
||||
await runBenchmark<PublicKey[], void>({
|
||||
|
|
Reference in New Issue